云题海 - 专业文章范例文档资料分享平台

当前位置:首页 > c语言编程题汇总

c语言编程题汇总

  • 62 次阅读
  • 3 次下载
  • 2025/6/22 14:02:44

1.

#include void main() { int i=1,sum=0; while(i<100) { sum=sum+i; i++; } printf(\} 2.

#include void main() { int score,max,min,i=0; float sum=0.0,average; printf(\请输入学生的成绩:\\n\ scanf(\ max=min=score; while(score!=-1) { if(score>=0&&score<=100) { sum=sum+score; i++; if(maxscore) min=score; } scanf(\ } average=sum*1.0/i; printf(\ printf(\有效成绩共%d个学生,平均分为:%f\\n\} 3.

#include void main() { int a,b,c; int count=0; int m=100; printf(\的水仙花数为:\ do {

a=m/100; b=(m-100*a)/10; c=m; if(a*a*a+b*b*b+c*c*c==m) { printf(\ count++; } m++; } while(m<1000); printf(\的水仙花数共%d个\\n\} 4.

#include #define N 20 void main() { int i; float m=1.0,n=2.0,t,p; double sum=0.0; t=m/n; for(i=1;i<=N;i++) { sum=sum+t; p=m+n; m=n; n=p; t=m/n; } printf(\前20项的结果为:%lf\\n\} 5.

#include #include void main() { int m,i=2; int flag=1; printf(\请输入一个数,验证是否为质数:\ scanf(\ for(i=2;i<=sqrt(m);i++) if (m%i==0) { flag=0; break;

}

}

if(flag=1) printf(\恭喜,你输入的数%d是质数!\\n\else printf(\对不起,你输入的数%d不是质数!\\n\

五、实验运行结果(截图):

1.

2.

3.

4.

搜索更多关于: c语言编程题汇总 的文档
  • 收藏
  • 违规举报
  • 版权认领
下载文档10.00 元 加入VIP免费下载
推荐下载
本文作者:...

共分享92篇相关文档

文档简介:

1. #include void main() { int i=1,sum=0; while(i<100) { sum=sum+i; i++; } printf(\} 2. #include void main() { int score,max,min,i=0; float sum=0.0,average; printf(\请输入学生的成绩:\\n\ scanf(\ max=min=score; while(score!=-1) { if(score>=0&&score<=100) { sum=sum+score; i++; if(maxscore) min=score; } sc

× 游客快捷下载通道(下载后可以自由复制和排版)
单篇付费下载
限时特价:10 元/份 原价:20元
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
VIP包月下载
特价:29 元/月 原价:99元
低至 0.3 元/份 每月下载150
全站内容免费自由复制
注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信:fanwen365 QQ:370150219
Copyright © 云题海 All Rights Reserved. 苏ICP备16052595号-3 网站地图 客服QQ:370150219 邮箱:370150219@qq.com