摘要: 1.定义圆形半径,求面积。Int r=5; package wen; public class Test { public static void main(String[] args) { // TODO Auto-generated method stub double r=5; double  阅读全文
posted @ 2023-03-22 20:25 张继炫 阅读(12) 评论(0) 推荐(0) 编辑
摘要: 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 张继炫 阅读(4) 评论(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 张继炫 阅读(4) 评论(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 张继炫 阅读(4) 评论(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) 编辑
摘要: 分数转成等级 switch #include<stdio.h> main() { int a; printf("请输入学生的分数(0-100):\n"); scanf("%d",&a); switch(a/10) { case 10: case 9:printf("A\n");break; case 阅读全文
posted @ 2021-10-31 22:01 张继炫 阅读(8) 评论(0) 推荐(0) 编辑
摘要: 1.编写程序,判断一个数是正数还是负数。 #include<stdio.h> main() { int n = -3; if(n<0) { printf("是负数"); } else printf("是正数"); } 2.编写程序,计算出租车的行驶距离与费用之间的关系。起步3km内,8元;之后1.6 阅读全文
posted @ 2021-10-24 22:22 张继炫 阅读(15) 评论(0) 推荐(0) 编辑
摘要: 1编写程序,定义两个整形变量,赋值并输出。 #include<stdio.h> main() { int a=2; int b=6; printf("%d%\n",a,b); } 2..编写程序,定义一个单精度和一个双精度的变量,赋值并输出 #include<stdio.h> main() { fl 阅读全文
posted @ 2021-10-24 22:20 张继炫 阅读(3) 评论(0) 推荐(0) 编辑