2023年4月3日
摘要: 分别使用for循环,while循环,do循环求1到100之间所有能被3整除的整数的和。(知识点:循环语句) package test; public class ass { public static void main(String[] args) { // TODO Auto-generated 阅读全文
posted @ 2023-04-03 19:49 王有胜 阅读(16) 评论(0) 推荐(0) 编辑
  2023年3月26日
摘要: 1 输入年份月份,输出该月的天数(闰年2月29天,条件参考上机练习1) package aac; import java.util.Scanner; public class test { public static void main(String[] args) { // TODO Auto-g 阅读全文
posted @ 2023-03-26 15:09 王有胜 阅读(8) 评论(0) 推荐(0) 编辑
  2023年3月19日
摘要: .1定义圆形半径,求面积 package diercizuoye; public class Timu1 { public static void main(String[] args) {// TODO Auto-generated method stubint r=5;System.out.pr 阅读全文
posted @ 2023-03-19 20:41 王有胜 阅读(25) 评论(0) 推荐(0) 编辑
  2021年12月9日
摘要: 1.输入一个三位数,求个位,十位,百位 #include<stdio.h> main(){ int a; int g,s,b; printf("请输入一个三位数:"); scanf("%d",&a); g=a%10; s=a%100/10; b=a/100; printf("个位为%d十位为%d百位 阅读全文
posted @ 2021-12-09 22:46 王有胜 阅读(18) 评论(0) 推荐(0) 编辑
摘要: #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--) { printf("%d\n",a[i]); } } 2.使用一维数 阅读全文
posted @ 2021-12-09 22:38 王有胜 阅读(46) 评论(0) 推荐(0) 编辑
摘要: 1.实现一个菜单 可以切换 ,可以返回主菜单 主菜单 1.登录 2.注册 3.输出水仙花数 4.退出程序 请选择: 选择后实现对应的功能 #include <stdio.h> void mainMenu(); void login(); void returnToMain(); void regis 阅读全文
posted @ 2021-12-09 22:33 王有胜 阅读(23) 评论(0) 推荐(0) 编辑
  2021年11月23日
摘要: 编写程序,统计字符串中大写字母的个数 #include<stdio.h> main() { char str[5]; int i,cnt; cnt=i=0; gets(str); while(str[i]!='\0') {if(str[i]>='A'&&str[i]<='Z') cnt++; i++ 阅读全文
posted @ 2021-11-23 09:52 王有胜 阅读(1) 评论(0) 推荐(0) 编辑
  2021年11月16日
摘要: 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-11-16 11:50 王有胜 阅读(28) 评论(0) 推荐(0) 编辑
摘要: 1.编写程序。使用scanf()函数接受整形,实型,字符型的变量,并分行依次输出 #include<stdio.h> main() { int a; float b; char c; scanf("%d%f%c",&a,&b,&c); printf("%d\n%c\n",a,b,c); } 2.编写 阅读全文
posted @ 2021-11-16 11:40 王有胜 阅读(28) 评论(0) 推荐(0) 编辑
摘要: 编写程序,使用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\n",sum); } 2.编写程序,使用while语句求 阅读全文
posted @ 2021-11-16 11:23 王有胜 阅读(8) 评论(0) 推荐(0) 编辑