摘要: 1.定义一个含有8个存储单元的实型数组,从键盘上接收数,然后逆序输出 #include<stdio.h> main() { int a[8],i; for(i=0;i<8;i++) { scanf("%d",&a[i]); } printf("逆序输出后\n"); for(i=7;i>=0;i--) 阅读全文
posted @ 2021-11-29 20:40 张继炫 阅读(5) 评论(0) 推荐(0) 编辑
摘要: 1.猜数 #include<stdio.h> #include <stdlib.h> #include <time.h> int main() { while(1) { int a=0,b; srand((unsigned)time(NULL)); a = rand()%100+1; printf( 阅读全文
posted @ 2021-11-29 20:39 张继炫 阅读(5) 评论(0) 推荐(0) 编辑
摘要: 1.输出图形 #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 阅读全文
posted @ 2021-11-29 20:21 张继炫 阅读(5) 评论(0) 推荐(0) 编辑
摘要: 1.p60 1 #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; 阅读全文
posted @ 2021-11-29 20:17 张继炫 阅读(2) 评论(0) 推荐(0) 编辑
摘要: 1.p70页一题 #include <stdio.h> main() { int n; printf("请输入一个数字"); scanf("%d",&n); if(n>0) printf("这个数字是正数"); else if(n==0) printf("这个数字是0"); else printf( 阅读全文
posted @ 2021-11-29 20:12 张继炫 阅读(5) 评论(0) 推荐(0) 编辑
摘要: 1.三角 #include<stdio.h> main(){ int i,j; for(i=0;i<=5;i++){ for(j=1;j<=1+i;j++){ printf("*"); } printf("\n"); } } #include<stdio.h> main(){ int i,j,k; 阅读全文
posted @ 2021-11-29 20:09 张继炫 阅读(11) 评论(0) 推荐(0) 编辑