解题思路:
注意事项:
参考代码:
#include <iostream>
#include <deque>
#include <algorithm>
#include <numeric>
#include <iterator>
#include <string>
#include <cmath>
#include <cstdlib>
#include <string.h>
using namespace std;
int f(int n)
{
int i=2;
for(i=2;i<n;i++)
{
if(n%i==0)
{
break;
}
}
if(n==i)
{
return 1;
}
else
{
return 0;
}
}
int main()
{
int n;
cin>>n;
if(f(n)==1)
{
cout<<"Y"<<endl;
}
else
{
cout<<"N"<<endl;
}
return 0;
}
0.0分
0 人评分
简单编码 (C++代码)浏览:678 |
C语言训练-列出最简真分数序列* (C语言代码)浏览:506 |
2003年秋浙江省计算机等级考试二级C 编程题(2) (C语言代码)浏览:541 |
C语言程序设计教程(第三版)课后习题5.6 (C语言代码)浏览:512 |
简单的a+b (C语言代码)浏览:631 |
WU-格式化数据输出 (C语言代码)浏览:1755 |
printf基础练习2 (C语言代码)浏览:747 |
C语言程序设计教程(第三版)课后习题11.1 (C语言代码)浏览:489 |
C二级辅导-求偶数和 (C语言代码)浏览:674 |
蛇行矩阵 (C语言代码)浏览:505 |