摘要: 编写程序,使用while语句求和sum=1+3+5+7+…+21。 #include<stdio.h> main(){ int m=1,sum=0; while(m<22){ if(m%2<=1) sum+=m; m+=2; } printf("%d\n",sum); } 2.编写程序,使用whil 阅读全文
posted @ 2021-11-09 10:18 清风饮露ㅤ 阅读(21) 评论(0) 推荐(0) 编辑
摘要: 1.将学生成绩分为A,B,C,D,NO PASS! #include<stdio.h> main(){ int m; printf("请输入学生的成绩(0-100):\n"); scanf("%d",&m); switch(m/10) { case 10: case 9:printf("A\n"); 阅读全文
posted @ 2021-10-31 23:44 清风饮露ㅤ 阅读(29) 评论(0) 推荐(0) 编辑
摘要: 编写程序,定义两个整型变量,赋值并输出。 #include<stdio.h> main() { int a=6; int b=8; printf("%d%d\n",a,b); } 2. 编写程序,定义一个单精度和一个双精度的变量,赋值并输出。 #include<stdio.h> main() { f 阅读全文
posted @ 2021-10-16 17:39 清风饮露ㅤ 阅读(38) 评论(0) 推荐(0) 编辑
摘要: 编写程序,输出;“我爱学习c语言!” #include<stdio.h> main() { printf("我爱学习c语言"); } 2分行输出自己的专业和姓名 #include<stdio.h> main() { printf("计算机2107\n张盛汇"); } 3用*输出字母c的图案 #inc 阅读全文
posted @ 2021-10-05 15:47 清风饮露ㅤ 阅读(10) 评论(0) 推荐(0) 编辑