摘要: 1.定义一个含有8个储存单元的实型数组,从键盘上接收数,然后逆向输出。 #include<stdio.h> main(){ int i; double a[8]; printf("请输入8个实数\n"); for(i=0;i<=7;i++){ scanf("%lf",&a[i]); } for(i= 阅读全文
posted @ 2021-11-21 14:24 你的梦想呢? 阅读(23) 评论(0) 推荐(0) 编辑
摘要: 1.随机产生一个0-99的数,猜猜看,如果大了,就显示大了点;如果小了,就显示小了点,直到猜对为止。 #include<stdio.h>#include<stdlib.h>#include<time.h>int main(){int a,n;srand((unsigned)time(NULL));a 阅读全文
posted @ 2021-11-21 14:18 你的梦想呢? 阅读(9) 评论(0) 推荐(0) 编辑
摘要: 1.输出以下图形. #include <stdio.h> main() { int i,j; for(i=1;i<=5;i++){ for(j=1;j<=i;j++){ printf("*"); } printf("\n"); } } 2.#include <stdio.h> main() { in 阅读全文
posted @ 2021-11-21 14:05 你的梦想呢? 阅读(7) 评论(0) 推荐(0) 编辑
摘要: 1编写程序,使用while语句求和sum=1+3+5+…+21 #include<stdio.h> main() { int i=1,sum=0; while(i<=21) { sum+=i; i+=2; } printf("%d\n",sum); } 2.编写程序,使用while语句求和sum=1 阅读全文
posted @ 2021-11-02 13:28 你的梦想呢? 阅读(21) 评论(0) 推荐(0) 编辑
摘要: 1.编写程序判断n是正数还是负数。 #include<stdio.h> main() { int n; printf("请输入一个整数:\n"); scanf("%d",&n); if(n>0) printf("%d是正数!\n",n); else if(n==0) printf("%d既不是正数, 阅读全文
posted @ 2021-11-02 13:23 你的梦想呢? 阅读(16) 评论(0) 推荐(0) 编辑
摘要: 1. #include<stdio.h> main() { int mark; printf("输入学生的分数(0-100):\n"); scanf("%d”,&mark); switch(mark/10) { case 10: //与case9:共用一条语句 case 9:printf("A\n" 阅读全文
posted @ 2021-11-02 13:07 你的梦想呢? 阅读(7) 评论(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-19 16:53 你的梦想呢? 阅读(5) 评论(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%d\n",a,b,c); 阅读全文
posted @ 2021-10-17 22:57 你的梦想呢? 阅读(9) 评论(0) 推荐(0) 编辑
摘要: 编写程序,定义两个整型变量,赋值并输出。 #include<stdio.h> main() { int a=2; int b=6; printf("%d%d\n",a,b); } 2.编写程序,定义一个单精度和一个双精度的变量,赋值并输出。 #include<stdio.h> main() { fl 阅读全文
posted @ 2021-10-17 22:53 你的梦想呢? 阅读(4) 评论(0) 推荐(0) 编辑
摘要: 编写程序,输出“我爱学习c语言!”. #include<stdio.h> main() { printf("我爱学习c语言!"); } 2.分行输出自己的专业和姓名。 #include<stdio.h> main() { printf("计算机科学与技术\n刘金秋"); } 3.用*号输出字母c的图 阅读全文
posted @ 2021-10-17 22:38 你的梦想呢? 阅读(20) 评论(0) 推荐(0) 编辑