摘要: 作业1.定义圆半径,求面积package one;public class mj { public static void main(String[] args) { double r=5; double area=3.14*r*r; System.out.println("半径是5,求圆的面积是" 阅读全文
posted @ 2023-03-31 22:21 史孟琦 阅读(34) 评论(0) 推荐(0)
摘要: #include<stdio.h> main() { int a; float b; char c; scanf("%d%f%c",&a,&b,&c); printf("%d\n%f\n%c\n",a,b,c); } #include<stdio.h> main() { float s,l; pri 阅读全文
posted @ 2021-11-24 23:06 史孟琦 阅读(31) 评论(0) 推荐(0)
摘要: #include<stdio.h> main() { char str[20]; int i,cnt; cnt= i=0; gets(str); while(str[i]!='\0') { if(str[i]>='A'&&str[i]<='Z') cnt++; i++; } printf("大写字母 阅读全文
posted @ 2021-11-24 22:58 史孟琦 阅读(30) 评论(0) 推荐(0)
摘要: 1.定义一个含有8个储存单元的实型数组,从键盘山接收数,然后逆序输出 #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", 阅读全文
posted @ 2021-11-22 21:43 史孟琦 阅读(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"); } } ******* ***** *** * 阅读全文
posted @ 2021-11-11 00:20 史孟琦 阅读(10) 评论(0) 推荐(0)
摘要: 1. #include<stdio.h> 2. main(){ 3. int i=1; 4. int sum=0; 5. while(i<=21) 6. { 7. sum+=i; 8. i+=2; 9. } 10. printf("sum=%d\n",sum); 11. 12. } 1. #incl 阅读全文
posted @ 2021-11-02 22:04 史孟琦 阅读(41) 评论(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-19 23:54 史孟琦 阅读(24) 评论(0) 推荐(0)
摘要: 1.编写程序,定义两个整形变量,赋值并输出 #include<stdio.h> main() { int a=5; int b=7; printf("%d %d\n",a,b); } #include<stdio.h> main() { float a=5.3; double b=6.53; pri 阅读全文
posted @ 2021-10-18 23:06 史孟琦 阅读(57) 评论(0) 推荐(0)
摘要: 1,编写程序,输出’我爱学习学习C语言!’ #include<stdio.h> main() { printf(" 我爱学习C语言"); } 2分行输出自己的专业和姓名 #include<stdio.h> main() { printf(" 计算机科学与技术2108\n"); printf(" 史孟 阅读全文
posted @ 2021-10-07 23:28 史孟琦 阅读(48) 评论(0) 推荐(0)