# include<stdio.h>
# include<math.h>
long prime(long);
int main()
{
long N,i;
scanf("%ld",&N);
if(prime(N)!=0&&prime(N)!=1)
printf("%ld is a prime number",N);
else
printf("%ld is not a prime number",N);
return 0;
}
long prime(long N)
{
long j;
for(j=2;j<=(int)sqrt(N);j++)
if(N%j==0)
return 0;
return N;
}
# include<math.h>
long prime(long);
int main()
{
long N,i;
scanf("%ld",&N);
if(prime(N)!=0&&prime(N)!=1)
printf("%ld is a prime number",N);
else
printf("%ld is not a prime number",N);
return 0;
}
long prime(long N)
{
long j;
for(j=2;j<=(int)sqrt(N);j++)
if(N%j==0)
return 0;
return N;
}
No comments:
Post a Comment
Comment of this content!