首页
烦恼
游戏
商业
娱乐
生活
教育
育儿
健康
艺术
IT
社会
数码
运动
汽车
其它
C语言编程编写程序,用穷举法输出100以内素数的和(请写出代码编
编写,用穷举法输出100以内素数的和(请写出代码编程过程)
#include
#include
void main() { int i,j,t,s=2; for(i=3;i<100;i++) { t=1; for(j=2;j<=sqrt(i);j++) if(i%j==0) { t=0; break; } if(t==1)s=s+i; } printf("%d\n",s); }
Home |
Login |
Contact Us
Copyright © 2022 All Rights Reserved. 知识问答-生活宝典 35D.net