2023年3月18日
摘要: 1. 定义圆形半径,求面积。int r =5; package lll; public class zhixiang { public static void main(String[] args) { // TODO Auto-generated method stub int a=3 ,r=5; 阅读全文
posted @ 2023-03-18 17:42 丝毫不慌 阅读(30) 评论(0) 推荐(0) 编辑
  2021年11月28日
摘要: 1. 实现一个菜单 可以切换 ,可以返回主菜单 主菜单 1.登录 2.注册 3.输出水仙花数 4.退出程序 请选择: 选择后实现对应的功能 #include <stdio.h> void caidan(); void denglu(); void zhuce(); void sxh(); void 阅读全文
posted @ 2021-11-28 20:45 丝毫不慌 阅读(22) 评论(0) 推荐(0) 编辑
  2021年11月23日
摘要: 1.定义一个含有8个存储单元的实行数据,从键盘上接收数,然后逆序输出; #include<stdio.h> main(){ double a[8]; int i=0; for(i=0;i<=7;i++){ scanf("%lf",&a[i]); } for(i=7;i>=0;i--){ printf 阅读全文
posted @ 2021-11-23 21:32 丝毫不慌 阅读(8) 评论(0) 推荐(0) 编辑
摘要: 1.编写程序,统计字符串中大写字母的个数。 #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++ 阅读全文
posted @ 2021-11-23 21:29 丝毫不慌 阅读(12) 评论(0) 推荐(0) 编辑
  2021年11月14日
摘要: 编写一个程序,求1-1/2+1/3-1/4+…+1/99-1/100 #include<stdio.h> main() { int i,k=1;float sum=0; for(i=1;i<=100;i++) {sum+=k*1.0/i;k=-k; } printf("sum=%f\n",sum); 阅读全文
posted @ 2021-11-14 21:26 丝毫不慌 阅读(18) 评论(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(){ int i,j,k; f 阅读全文
posted @ 2021-11-14 21:24 丝毫不慌 阅读(16) 评论(0) 推荐(0) 编辑
  2021年11月5日
摘要: 1.编写程序,使用while语句求和sum=1+3+5+7+….+21..。 #include<stdio.h> main(){ int a=1,sum=0; while(a<=21) { sum+=a; a+=2; } printf("sum的值是%d",sum); } 2.编写程序,使用whil 阅读全文
posted @ 2021-11-05 21:24 丝毫不慌 阅读(6) 评论(0) 推荐(0) 编辑
  2021年10月26日
摘要: 1. #include<stdio.h> main(){ int a,b; printf("请输入分数:"); scanf("%d",&a); b=a/10; switch(b) { case 10: case 9:printf("A\n");break; case 8:printf("B\n"); 阅读全文
posted @ 2021-10-26 10:53 丝毫不慌 阅读(19) 评论(0) 推荐(0) 编辑
  2021年10月23日
摘要: 1.输入一个数,输出他是正数还是负数. #include<stdio.h> main(){ float a; scanf("%f",&a); if(a>0){ printf("是正数\n"); }else if(a==0){ printf("既不是正数也不是负数\n"); }else { print 阅读全文
posted @ 2021-10-23 17:01 丝毫不慌 阅读(22) 评论(0) 推荐(0) 编辑
  2021年10月15日
摘要: 1. #include <stdio.h> main(){ int a=1 ; int b=2; printf("%d %d\n",a,b); } 2. #include <stdio.h> main(){ float a=1.23; double b=2.56; printf("%f %lf\n" 阅读全文
posted @ 2021-10-15 21:36 丝毫不慌 阅读(34) 评论(0) 推荐(0) 编辑