1 #include<stdio.h>
2
3int isPrime(int,int);
4
5int main(){
6
7 int num,prime;
8
9 printf("Enter a positive number: ");
10 scanf("%d",&num);
11
12 prime = isPrime(num,num/2);
13
14 if(prime==1)
15 printf("%d is a prime number",num);
16 else
17 printf("%d is not a prime number",num);
18
19 return 0;
20}
21
22int isPrime(int num,int i){
23
24 if(i==1){
25 return 1;
26 }else{
27 if(num%i==0)
28 return 0;
29 else
30 isPrime(num,i-1);
31 }
32}