#include <stdio.h>
int main()
{
int n, count = 0;
printf("Enter a number : ");
scanf("%d" , &n );
for(int i = 2 ; i < n; i++ )
{
if( n % i == 0 )
count++; // counting the number of factors.
} if( count == 0 ) printf("\n%d is a Prime number", n); else printf("%d is not a Prime number", n); }
} if( count == 0 ) printf("\n%d is a Prime number", n); else printf("%d is not a Prime number", n); }
Comments
Post a Comment