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;
}
}
Code Example |
---|
C :: type change in c |
C :: how to open jupyter notebook in local disk D |
C :: random number c |
C :: prime numbers c |
C :: take array as input in c |
C :: arduino digital input pins |
C :: npm fix old lockfile |
C :: input in c |
C :: dynamically create matrix c |
C :: c language append line to file |
C :: if statement c short form |
C :: check if the c code is a palindrome |
C :: how to print value of pointer in c |
C :: write a binary file c |
C :: c print multiple variables |
C :: typedef in c |
C :: Counting Sort C |
C :: add a item to cart woocomerce with quantity |
C :: read from stdin c |
C :: remove string from string c |
C :: how i send custom data in model field rest_framework serializer |
C :: typedef vs #define |
C :: declare variables arduino |
C :: millis() |
C :: c double |
C :: c language |
C :: access 2d array with pointer c |
C :: 1000000000 |
C :: %= in c |
C :: C Syntax of goto Statement |