C语言实验——素数 (sdut oj)
来源:互联网 发布:js实现二维码生成 编辑:程序博客网 时间:2024/06/08 01:05
C语言实验——素数
Time Limit: 1000MS Memory Limit: 65536KB
Problem Description
输出100->200之间的素数的个数,以及所有的素数。
Input
无
Output
100->200之间的素数的个数,以及所有的素数。
Example Input
Example Output
21101 103 ... 197 199
Hint
Author
ZJGSU
参考代码
#include<stdio.h>int main(){ int i; int temp; int a = 0; for(i = 100; i <= 200; i++) { for(temp = 2; temp < i; temp++) { if(i%temp == 0) { break; } } if(temp == i) { a++; } } printf("%d\n",a); for(i = 100; i <= 200; i++) { for(temp = 2; temp < i; temp++) { if(i % temp == 0) { break; } } if(temp == i) { printf("%d ",i); } } return 0;}
0 0
- C语言实验——素数 (sdut oj)
- C语言实验——判断素数(循环结构)(sdut oj)
- C语言实验——输出字符串(sdut oj)
- C语言实验——打印图形 (sdut oj)
- C语言实验——逆置正整数 (sdut oj)
- C语言实验——买糖果 (sdut oj)
- C语言实验——圆柱体计算 (sdut oj)
- C语言实验——温度转换 (sdut oj)
- C语言实验——时间间隔 (sdut oj)
- C语言实验——两个数最大 (sdut oj)
- C语言实验——三个数排序 (sdut oj)
- C语言实验——找中间数 (sdut oj)
- C语言实验——整除 (sdut oj)
- C语言实验——某年某月的天数 (sdut oj)
- C语言实验——圆周率 (sdut oj)
- C语言实验——两个数比较 (sdut oj)
- C语言实验——分数序列 (sdut oj)
- C语言实验——打印数字图形 (sdut oj)
- 【简单搜索】POJ2251Dungeon Master
- java类初始化顺序
- 评估方法、性能度量和比较检验
- spring boot 学习(六)spring boot 各版本中使用 log4j2 记录日志
- Android各个Support Library介绍
- C语言实验——素数 (sdut oj)
- UnitySDK接入——Android篇
- 推荐系统机器学习领域大牛主页
- 301、404、200、304等HTTP状态
- C++ primer-练习6.17
- cannot resove symbol '@mipmap/xx.9.png'点9图片报错
- Spring Boot 日志配置 logback和log4j2
- java多线程CyclicBarrier使用示例,让线程起步走
- 动态规划