Skip to content

SuvamRoutray/Finding-a-number-is-prime-or-not-using-recursion-

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

#include<stdio.h>

int CheckForPrime(int); int i;

int main() { int n1,PrimeNo; printf("Input any positive number:-\n"); scanf("%d",&n1); i=n1/2; PrimeNo=CheckForPrime(n1); if(PrimeNo==1) { printf("The number %d is a prime number\n",n1); } else { printf("The number %d is not a prime number\n",n1); } return 0; }

int CheckForPrime(int n1) { if(i==1) { return 1; } else if(n1%i==0) { return 0; } else { i=i-1; CheckForPrime(n1); } }

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published