摘要: 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"); 阅读全文
posted @ 2021-10-30 17:41 山有扶苏3 阅读(28) 评论(0) 推荐(0) 编辑
摘要: 1.编写程序判断n是正数还是负数。 #include<stdio.h>main(){int n;printf("输入一个整数:\n");scanf("%d",&n);if(n>0)printf("%d是正数!\n",n);elseif(n==0)printf("%d既不是正数,也不是负数!\n",n 阅读全文
posted @ 2021-10-30 17:41 山有扶苏3 阅读(14) 评论(0) 推荐(0) 编辑
摘要: 1,编写程序,使用scanf()函数接收整型,实型,字符型的变量,并分行依次输出。 main() { int a;#include<stdio.h> 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 17:30 山有扶苏3 阅读(23) 评论(0) 推荐(0) 编辑
摘要: 1.编写程序,输出“我爱学习C语言!” #include<stdio.h> main() { printf("我爱C语言!\n"); } 2.分行输出自己的专业和姓名 #include<stdio.h> main() { printf("信息与控制工程系\n计算机科学技术\n赵航"); } 3.用* 阅读全文
posted @ 2021-10-30 17:28 山有扶苏3 阅读(19) 评论(0) 推荐(0) 编辑
摘要: 1.编写程序,定义两个整形变量,赋值并输出 #include<stdio.h> main(){ int a=5; int b=6; printf("%d %d\n",a,b);} 2.编写程序,定义一个双精度变量和一个单精度变量,赋值并输出。 #include<stdio.h> main(){ fl 阅读全文
posted @ 2021-10-30 17:28 山有扶苏3 阅读(10) 评论(0) 推荐(0) 编辑