All pastes #346325 Raw Edit

CP:Simon

public c v1 · immutable
·published 2007-02-09 07:55 UTC
rendered paste body
#include <a_samp>main(){	for(new i = 0; i <= 20; i++)	{	    if (IsPrime(i)) {	        printf("%d is a PRIME number!", i);	    }	    else {	        printf("%d is a NATURAL number!", i);	    }	}}IsPrime(val){	if (val == 0 || val == 1 || val == 2 || val == 3 || val == 5) { 		return 1; 	} 		// If the remainder of the value is 0 when divided by	// 2, 3, 4 or 5 then it's NOT a "Natural number" therefore	// it's a "Prime number".	if (val % 2 == 0 || val % 3 == 0 || val % 5 == 0) {		return 0;	}		// Else if it's not a Natural number then it's a Prime number.	return 1;}