摘要: 1.分数转成等级 switch #include<stdio.h> main(){ int mark; printf("请输入学生分数(0-100);\n"); scanf("%d",&mark); switch(mark/10) { case 10: case 9:printf("A\n");br 阅读全文
posted @ 2021-10-30 16:36 梁冉 阅读(12) 评论(0) 推荐(0)
摘要: 编写程序,判断一个数n是正数还是负数。 #include<stdio.h> main() { float n; scanf("%f",&n); if(n>0) printf("正数\n"); else if(n==0) printf("0既不是正数也不是负数\n"); else printf(“负数 阅读全文
posted @ 2021-10-30 13:22 梁冉 阅读(19) 评论(0) 推荐(0)
摘要: 7.编写程序,使用scanf()函数接收整型,实型,字符型的变量,并分行依次输出。 #include<stdio.h> main() { int a; float b; char c; scanf("%d,%f,%c",&a,&b,&c); printf("%d\n%f\n%c\n",a,b,c); 阅读全文
posted @ 2021-10-30 13:01 梁冉 阅读(26) 评论(0) 推荐(0)