解题思路:
注意事项:
参考代码:
#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 人评分
简单的a+b (C语言代码)浏览:546 |
1035 题解浏览:785 |
C语言程序设计教程(第三版)课后习题9.10 (C语言代码)浏览:622 |
WU-C语言程序设计教程(第三版)课后习题12.3 (C++代码)浏览:862 |
非常简单的算法,题解1049:C语言程序设计教程(第三版)课后习题11.1 (C语言代码)浏览:620 |
C二级辅导-公约公倍 (C语言代码)浏览:663 |
WU-玉龙学长买雪糕 (C++代码)浏览:1112 |
Hello, world! (C语言代码)浏览:735 |
C二级辅导-阶乘数列 (C语言代码)浏览:393 |
C语言程序设计教程(第三版)课后习题6.8 (C语言代码)浏览:526 |