1int isPrime(long long number) {
2
3 if (number == 0 || number == 1 || (number % 2 == 0 && number > 2)) {
4 return 0;
5 }
6
7 else {
8 for (long long i=3; i <= (long long)sqrt(number)+1; i++) {
9 if (number % i == 0) {
10 return 0;
11 }
12 }
13 return 1;
14 }
15}
1#include <stdio.h>
2int main()
3{
4 int i, num, p = 0;
5 printf("Please enter a number: \n");
6 scanf("%d", &num);
7 for(i=1; i<=num; i++)
8 {
9 if(num%i==0)
10 {
11 p++;
12 }
13 }
14 if(p==2)
15 {
16 printf("Entered number is %d "\
17 "and it is a prime number.",num);
18 }
19 else
20 {
21 printf("Entered number is %d "\
22 "and it is not a prime number.",num);
23 }
24}
25