this is a program for searching the prime number by input from user
#include"stdio.h"
main()
{
int x, i,j;
int a = 0;
printf(“enter the number you want to know: ”);
scanf(“%d”,&x);
for(i=1;i
if(x%i==0){
a++;
}
}
if(a==2){
printf(“%d is prime number\n”,x);
}
else
{
printf(“number your input is not prime number”);
}
}
No comments:
Post a Comment