摘要: 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]); } P121 2题 #include<st 阅读全文
posted @ 2021-11-16 16:47 李鸾仪 阅读(9) 评论(0) 推荐(0) 编辑
摘要: 1. 猜数字: 随机产生一个0-99的数,猜猜看 如果大了 就提示大了点 如果小了 就提示小了点 直到猜对为止 #include <stdio.h> #include <stdlib.h> #include <time.h> int main() { int a,b,c; srand((unsign 阅读全文
posted @ 2021-11-16 16:46 李鸾仪 阅读(9) 评论(0) 推荐(0) 编辑
摘要: 1. 输出如下形状 ******* ***** *** * * ** *** **** ***** #include <stdio.h> main() { int i,a; for (i=1;i<=5;i++) { for (a=1;a<=i;a++) printf("*"); printf("\n 阅读全文
posted @ 2021-11-16 16:45 李鸾仪 阅读(12) 评论(0) 推荐(0) 编辑
摘要: 1,#include<stdio.h> main(){ int i=1;int sum=0; while(i<=21) {sum+=i; i+=2; } printf("sum=%d\n",sum); } 2, #include<stdio.h> main(){ int i=1;double sum 阅读全文
posted @ 2021-11-16 16:44 李鸾仪 阅读(19) 评论(0) 推荐(0) 编辑
摘要: 1.编写程序判断n是正数还是负数。 1.#include <stdio.h> main() { float n; printf("输入一个数:\n"); scanf("%f",&n); if(n>0) printf("正数\n"); else if(n==0) printf("既不是正数也不是负数\ 阅读全文
posted @ 2021-11-16 16:44 李鸾仪 阅读(12) 评论(0) 推荐(0) 编辑
摘要: 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-11-16 16:43 李鸾仪 阅读(4) 评论(0) 推荐(0) 编辑