摘要: 1 定义圆形半径,求面积。 ort java.util.Scanner; import javax.swing.plaf.basic.BasicInternalFrameTitlePane.SystemMenuBar; public class index { public static void 阅读全文
posted @ 2023-03-17 18:22 《/》 阅读(21) 评论(0) 推荐(0)
摘要: 1.猜数字: 随机产生一个0-99的数,猜猜看 如果大了 就提示大了点 如果小了 就提示小了点 直到猜对为止 #include <stdio.h> #include <stdlib.h> #include <time.h> main(){ int x,guess; srand((unsigned i 阅读全文
posted @ 2021-11-18 17:23 《/》 阅读(30) 评论(0) 推荐(0)
摘要: 猜数字: 随机产生一个0-99的数,猜猜看 如果大了 就提示大了点 如果小了 就提示小了点 直到猜对为止 #include <stdio.h> #include <stdlib.h> #include <time.h> main(){ int x,guess; srand((unsigned int 阅读全文
posted @ 2021-11-18 17:22 《/》 阅读(18) 评论(0) 推荐(0)
摘要: 输出图形 #include<stdio.h> int main() { int f,g,i; for(i=1;i<=5;i++) { for(g=1;g<=i;g++) {printf("*");} printf("\n"); } for(i=6;i<=10;i++) {printf("\n");} 阅读全文
posted @ 2021-11-18 17:16 《/》 阅读(15) 评论(0) 推荐(0)
摘要: 1.编写程序,使用while语句求和sum=1+2+3+4+…+21. #include<stdio.h> main() { int i=1;int sum=0; while(i<=21) { sum+=i; i+=2; } printf("sum=%d\n",sum); } 2.编写程序,使用wh 阅读全文
posted @ 2021-11-07 20:28 《/》 阅读(45) 评论(0) 推荐(0)
摘要: 1.分数转成等级 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; ca 阅读全文
posted @ 2021-10-31 21:54 《/》 阅读(53) 评论(0) 推荐(0)
摘要: 1.编写程序,判断一个数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-24 22:14 《/》 阅读(50) 评论(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-12 12:08 《/》 阅读(25) 评论(0) 推荐(0)
摘要: 1.编写程序,输出“我爱学习c语言!” #include<stdio.h> main() { printf("我爱学习c语言!"); } 2.分行输出自己的专业和姓名。 #include<stdio.h> main() { printf("计算机科学与技术\n"); printf("徐玮"); } 阅读全文
posted @ 2021-10-07 12:47 《/》 阅读(57) 评论(0) 推荐(0)