Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR C

prime chec kin c

int isPrime(long long number) {

	if (number == 0 || number == 1 || (number % 2 == 0 && number > 2)) {
		return 0;
	}

	else {
		for (long long i=3; i <= (long long)sqrt(number)+1; i++) {
			if (number % i == 0) {
				return 0;
			}
		}
		return 1;
	}
}
 
PREVIOUS NEXT
Tagged: #prime #chec #kin
ADD COMMENT
Topic
Name
8+5 =