50-题目1047:素数判定
来源:互联网 发布:java程序员书籍推荐 编辑:程序博客网 时间:2024/06/05 22:44
http://ac.jobdu.com/problem.php?pid=1047
- 题目描述:
给定一个数n,要求判断其是否为素数(0,1,负数都是非素数)。
- 输入:
测试数据有多组,每组输入一个数n。
- 输出:
对于每组输入,若是素数则输出yes,否则输入no。
#include<iostream>#include<fstream>using namespace std;int main(){int n, i;ifstream cin("data.txt");while (cin >> n){for (i = 2; i < n; i++)if (n % i == 0)break;if (i == n)cout << "yes" << endl;elsecout << "no" << endl;}system("pause");return 0;}
0 0
- 50-题目1047:素数判定
- 题目1047:素数判定
- 题目1047:素数判定
- 题目1047:素数判定
- 题目1047:素数判定
- 题目1047:素数判定
- 题目1047:素数判定
- 题目1047:素数判定
- 题目1047:素数判定
- 题目50:素数判定
- 【九度】题目1047:素数判定
- 九度题目1047素数判定
- 九度oj 题目1047:素数判定
- 九度OJ-题目1047 素数判定
- 九度OJ题目1047:素数判定
- 题目1044: 素数判定
- 题目1040:Prime Number 题目1047:素数判定
- hduoj 素数判定 题目2012
- VR 开发
- JavaScript 正则表达式上——基本语法
- VIM命令大全
- Androidstudio生成的Apk文件路径
- 打造属于自己的侧边栏(SlidingMenu)
- 50-题目1047:素数判定
- iOS中二进制数据转成字典
- ogre文字动态加载实现和bug修改
- P与NP
- WARN Fetching topic metadata with correlation id 955 for topics [Set(test3)] from broker [BrokerEndP
- git
- Codeforces 651B Beautiful Paintings【思维】
- 我的第一篇博客 - java 环境变量设置
- android柱状progressbar