10 2021 档案

摘要:1.教材P52 例4-8 分数转成等级 switch #include <stdio.h> main() { int mark; printf("输入成绩\n"); scanf("%d",&mark); switch(mark/10) { case 10: case 9:printf("A\n"); 阅读全文
posted @ 2021-10-31 20:24 三庭远 阅读(35) 评论(0) 推荐(0)
摘要:编写程序判断n是正数还是负数 #include <stdio.h> main(){ int n; scanf("%d",&n); if(n>0){ printf("正数"); } else if(n<0){ printf("负数"); } } 2.使用条件运算符,找出四个数a,b,c,d四个数中最大 阅读全文
posted @ 2021-10-31 20:20 三庭远 阅读(65) 评论(0) 推荐(0)
摘要:3.编写程序,判断一个数n是正数还是负数。 #include<stdio.h> main() { float n; scanf("%f",&n); if(n>0) printf("正数!\n"); else if(n==0) printf("0既不是正数,也不是负数!\n"); else print 阅读全文
posted @ 2021-10-24 12:00 三庭远 阅读(41) 评论(0) 推荐(0)
摘要:编写程序,定义两个整形变量,赋值并输出。 #include<stdio.h> main(){ int a=1; int b=2; printf("%d%d\n",a,b); } 2.编写程序,定义一个单精度和一个双精度的变量,赋值并输出。 #include<stdio.h> main(){ floa 阅读全文
posted @ 2021-10-17 15:39 三庭远 阅读(82) 评论(0) 推荐(0)
摘要:1编写程序使用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); 2编 阅读全文
posted @ 2021-10-17 15:27 三庭远 阅读(43) 评论(0) 推荐(0)
摘要:1.编写程序我爱学习C语言 #include<stdio.h> main() { printf("我爱学习C语言"); } 2.分行输出自己的专业和名字 #include<stdio.h> main() { printf("计算机科学与技术\n"); printf("麻麟濡\n"); } 3.用*号 阅读全文
posted @ 2021-10-07 20:35 三庭远 阅读(54) 评论(0) 推荐(0)