摘要: #include <stdio.h> main() { int a,b,n; for(a=1;a<=5;a++) { printf("\n"); for(b=1;b<=a;b++) { printf("*"); } } } #include <stdio.h> main() { int a,b,n; 阅读全文
posted @ 2021-12-09 10:51 淘气5555 阅读(4) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h> main() { int a=1,b=0; while(a<=21) { if(a%2) b=b+a; a++; } printf("%d",b); } 2.p60 2 #include <stdio.h> main() { int i=1,n; double 阅读全文
posted @ 2021-12-09 10:50 淘气5555 阅读(9) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h> main() { int n; printf("请输入一个数字"); scanf("%d",&n); if(n>0) printf("这个数字是正数"); else if(n==0) printf("这个数字是0"); else printf("这个数字是负数" 阅读全文
posted @ 2021-12-09 10:48 淘气5555 阅读(16) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h> main() { int f; printf("请输入学生的分数(0-100):\n"); scanf("%d",&f); switch(f/10) { case 10: case 9:printf("A\n");break; case 8:printf("B\ 阅读全文
posted @ 2021-12-09 10:46 淘气5555 阅读(25) 评论(0) 推荐(0) 编辑
摘要: 1出租车行驶计价 #include<stdio.h> main() { float s, l; printf("输入行驶距离:\n"); scanf("%f",&l); if(l<=3) s=8; else s=(l-3)*1.6+8; printf("%.2f\n",s); 2,判断正负数 inc 阅读全文
posted @ 2021-10-24 08:21 淘气5555 阅读(11) 评论(0) 推荐(0) 编辑
摘要: 1.编写程序,使用scanf()接收整型·实型·字符型的变量,并分行依次输出。 #include <stdio.h> main() { int a=1; float b=2; char c='5'; printf("%d\n%f\n%c\n",a,b,c); } 2.编写程序,通过scanf()函数 阅读全文
posted @ 2021-10-17 09:51 淘气5555 阅读(9) 评论(0) 推荐(0) 编辑
摘要: 1.编写程序,定义两个整形变量,赋值并输出。 #include <stdio.h> main() { int a=6; int b=8; printf("%d%d\n",a,b); } 2.编写程序,定义一个单精度和一个双精度的变量,赋值并输出。 #include <stdio.h> main() 阅读全文
posted @ 2021-10-17 09:44 淘气5555 阅读(40) 评论(0) 推荐(0) 编辑
摘要: 编写一个程序,输出“我爱学习c语言” #include<stdio.h> main() { printf( "我爱学习c语言!"); } 分行输出自己的专业和姓名 #include<stdio.h> main() { printf("计算机科学与技术\n"); printf("王佳鑫\n"); } 阅读全文
posted @ 2021-10-07 14:40 淘气5555 阅读(11) 评论(0) 推荐(0) 编辑