#include<stdio.h>
main()
{
int n,i,count=0;
printf("enter a number:");
scanf("%d",&n);
for(i=2;i<n;i++)
{
if(n%i==0)
{
count++;
}
}
if(count==0)
{
printf("the given number is a prime\n");
}
else
{
printf("the given number is not a prime\n");
}
}
output:
No comments:
Post a Comment