Here we gave easiest understanding program to you.
All programs easy to learn every person.
And all subjects are compulsory in BCA.
Powered by Blogger.

Followers

Tuesday, 17 September 2019

Prime number in c program

0 comments

/* C Program to verify given no. is prime or not */




#include<stdio.h> 
int main() 
{  
int n,f=0,i=1;   
printf("Enter a no:");
scanf("%d",&n);    while(n>=i)
  {
if(n%i==0)  
f=f+1; 
i++;
  }   
  if(f==2) printf("Prime");
  else   
printf("Not Prime");   return 0;
}
 
INPUT/OUTPUT:

Enter a no:7

No comments:

Post a Comment