摘要: 1 输入年份月份,输出该月的天数(闰年2月29天,条件参考上机练习1) package zuoye; import java.util.Scanner; public class Timu1 { public static void main(String[] args) { // TODO Aut 阅读全文
posted @ 2023-03-31 21:03 MENGYINGCAI 阅读(39) 评论(0) 推荐(0)
摘要: 1.定义圆形半径,求面积 package diercizuoye; import java.util.Scanner; public class Timu1 { public static void main(String[] args) { // TODO Auto-generated metho 阅读全文
posted @ 2023-03-19 16:55 MENGYINGCAI 阅读(26) 评论(0) 推荐(0)
摘要: 1.编写程序输入一个三位数,求出个位,十位,百位. #include<stdio.h> main(){ int i,a,b,c; printf("输出一个三位数\n"); scanf("%d",&i); a=i/100; b=i%100/10; c=i%10; printf("%d,%d,%d",a 阅读全文
posted @ 2021-12-05 13:25 MENGYINGCAI 阅读(42) 评论(0) 推荐(0)
摘要: 1.实现一个菜单 可以切换 ,可以返回主菜单 主菜单 1.登录 2.注册 3.输出水仙花数 4.退出程序 请选择: 选择后实现对应的功能 #include<stdio.h> void mainMenu(); void two(); main() { mainMenu(); } void mainMe 阅读全文
posted @ 2021-12-05 13:14 MENGYINGCAI 阅读(36) 评论(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-12-05 13:09 MENGYINGCAI 阅读(41) 评论(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-12-05 13:05 MENGYINGCAI 阅读(114) 评论(0) 推荐(0)
摘要: 猜数字: 随机产生一个0-99的数,猜猜看 如果大了 就提示大了点 如果小了 就提示小了点 直到猜对为止 #include <stdio.h> #include <stdlib.h> #include <time.h> main(){ int x,guess; srand((unsigned int 阅读全文
posted @ 2021-12-05 12:59 MENGYINGCAI 阅读(23) 评论(0) 推荐(0)
摘要: 输出以下图形 #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() 阅读全文
posted @ 2021-11-18 17:30 MENGYINGCAI 阅读(26) 评论(0) 推荐(0)
摘要: 1编写程序,使用while语句求和sum1+2+3+5+…+21. #include<stdio.h> main() { int i=1;int sum=0; while(i<=21) { sum+=i; i+=2; } printf("Sum=%d\n",sum); } 编写程序,使用while语 阅读全文
posted @ 2021-11-06 16:47 MENGYINGCAI 阅读(26) 评论(0) 推荐(0)
摘要: 1编写程序,使用if的多分支选择结构,将输入分数mark(0-100整数)转换为相应的等级)(900~100为A,80~89为B,70~79为C,60~69为D,0~59为NO PASS) #include<stdio.h> main() { int mark; printf("输入学生的分数(0- 阅读全文
posted @ 2021-10-29 14:02 MENGYINGCAI 阅读(42) 评论(0) 推荐(0)