摘要: 1.编写程序,统计字符串中大写字母的个数。 #include<stdio.h> main(){ char a[10]; int b=0,c=0; gets(a); while(a[b]!='\0') { if(a[b]>='A'&&a[b]<='Z') c++; b++; } printf("%d\ 阅读全文
posted @ 2021-11-28 23:38 刘赓 阅读(25) 评论(0) 推荐(0)
摘要: 1.P121 1 #include<stdio.h> main(){ double m[8]; int i; for(i=0;i<=7;i++) scanf("%lf",&m[i]); for(i=7;i>=0;i--) printf("%f",m[i]); } 2.P121 2 #include< 阅读全文
posted @ 2021-11-22 20:27 刘赓 阅读(34) 评论(0) 推荐(0)
摘要: 1.输出图 #include<stdio.h> main(){ int i,j,k; for(i=1;i<=5;i++) { for(k=1;k<=i;k++) printf("*"); printf("\n"); } } 输出 #include<stdio.h> main(){ int i,j,k 阅读全文
posted @ 2021-11-09 10:12 刘赓 阅读(14) 评论(0) 推荐(0)
摘要: 1.编写程序,使用while语句求和sum=1+3+5+7+…+21。 #include<stdio.h> main(){ int a=1,sum=0; while(a<22){ if(a%2<=1) sum+=a; a+=2; } printf("%d\n",sum); } 2.编写程序,使用wh 阅读全文
posted @ 2021-11-06 15:46 刘赓 阅读(33) 评论(0) 推荐(0)
摘要: 1.输入学生分数,输出等级。 #include<stdio.h> main(){ int a; printf("输入学生分数(0-100):\n"); scanf("%d",&a); switch(a/10) { case 10: case 9:printf("A\n");break; case 8 阅读全文
posted @ 2021-10-30 23:29 刘赓 阅读(17) 评论(0) 推荐(0)
摘要: 1.编写程序,定义两个整形变量,赋值并输出。 #include<stdio.h> main(){ int a=1; int b=2; printf("%d%d\n",a,b); } 2.编写程序,定义一个单精度和一个双精度的变量,赋值并输出。 #include<stdio.h> main(){ fl 阅读全文
posted @ 2021-10-16 13:39 刘赓 阅读(43) 评论(0) 推荐(0)
摘要: 一.编写程序,输出“我爱学习C语言!”。 #include<stdio.h> main() { printf("我爱学习C语言!"); } 二.分行输出自己的专业和姓名。 #include<stdio.h> main(){ printf("计算机科学与技术\n"); printf("刘赓\n"); 阅读全文
posted @ 2021-10-05 20:34 刘赓 阅读(22) 评论(0) 推荐(0)