C program to test for a prime number
March 10, 2020
Below is a C program to test for a prime number –
main(){
float n, count = 0; i = 3; a;
printf("\nEnter any number of your choice>>");
scanf("%f", &n);
if(n == 0 || n == 1 || n == 2)
printf("\n%d is not a prime number\n", n);
while(i > 2 & i < n){
if(!(n % i))
count = 1;
i++;
}
if(count == 0)
printf("\nPRIME!!");
else
printf("\nNot Prime.");
}