#include<stdio.h>
int main()
{
int num=0;
printf("请输入一个数:\n");
scanf("%d",&num);
int i=2,a=0;
for(i;i<num;i++)
{
if(num%i==0)
a++;
}
if(a==0)
{
printf("%d是素数.\n",num);
}
else
{
printf("%d不是素数.\n",num);
}
return 0;
}
警告信息:||=== Build: Debug in practice (compiler: GNU GCC Compiler) ===|
E:\c++\practice\main.cpp||In function 'int main()':|
E:\c++\practice\main.cpp|8|warning: statement has no effect [-Wunused-value]|
||=== Build finished: 0 error(s), 1 warning(s) (0 minute(s), 1 second(s)) ===|
饮歌长啸
慕丝7291255
相关分类