#include<stdio.h>
#include<stdlib.h>
void main()
{
int sum=0, i, a;
printf("Enter a number ") ; scanf (" %d", &a) ; for(i=1; i<=a; i++) { if(a%i==0) { sum++; } } if(sum==2) { printf ("%d is a prime number ", a) ; } else { printf (" %d is not a prime number,", a); } } |
Enter a number : 13 13 is a prime number