- 博客(11)
- 收藏
- 关注
原创 第三章--练习3
public class Demo3 { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.println(“请输入您出行的月份:”); int month = input.nextInt(); System.out.println(“请问您选择头等舱还是经济舱?头等舱输入1,经济舱输入2”); int type = input.nextInt(); double price
2021-03-21 19:56:15
80
原创 第三章--练习2
public class Demo1{ public static void main(string[] args){ scanner input =new scanner(system.in); for(boolean i=true;i;){ system.out.print(“请你输入一个数值:”) int num=input.nextInt(); switch(num){ case 0: i =false; system.out.println(“程序结束”); break; case 1: syst
2021-03-21 19:52:51
90
原创 第三章--练习1
package good; import java.util.Scanner; public class Apoln { public static void main(String[] args) { int max = 0; int min = 0; int sum = 0; Scanner input = new Scanner(System.in); while (true) { System.out.println(“请输入一个整数(输入0结束)”); int i = input.nextInt(
2021-03-21 19:47:20
65
原创 for
package Demo3; public class for3 { public static void main(String[] args) { int i = 0, sum = 0; for (; i <= 100; i++) { //for (;i <= 100;i += 2){ if (i % 2 == 0) { sum += i; }
2021-03-13 17:13:37
84
原创 do-while
package Demo2; public class doWhile2 { public static void main(String[] args) { int i = 0,sum = 0; do { if (i%2 == 0) sum += i; i++; //i += 2; //sum += i; }while(i
2021-03-13 17:13:05
54
原创 while
这里写自定义目录标题欢迎使用Markdown编辑器新的改变功能快捷键合理的创建标题,有助于目录的生成如何改变文本的样式插入链接与图片如何插入一段漂亮的代码片生成一个适合你的列表创建一个表格设定内容居中、居左、居右SmartyPants创建一个自定义列表如何创建一个注脚注释也是必不可少的KaTeX数学公式新的甘特图功能,丰富你的文章UML 图表FLowchart流程图导出与导入导出导入 package Demo1; public class while1 { public static void m
2021-03-13 17:11:59
59
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人