第1个回答 2018-01-17
#include <stdio.h>
#include <math.h>
int main()
{
int n;
scanf("%d",&n);
for(int i=2;i<=sqrt(n);i++)
if(n%i==0)
{
printf("This is not a prime number\n");
return 0;
}
printf("This is a prime number\n");
return 0;
}本回答被提问者采纳
第2个回答 2018-01-17
#include "stdio.h"
int main()
{
int m,i;
scanf("%d", &m);
for (i = 2; i < m; i++)
{
if (n%i == 0) break;
}
if (i == m)
printf("his is a prime number");
else
printf("his is not a prime number");
while (1);
}