标签:eth generate highlight Stub int png 第四周 一个 class
1
package doom2; import java.util.Scanner; public class thefourweekwork1 { public static void main(String[] args) { // TODO Auto-generated method stub Scanner input =new Scanner(System.in); System.out.print("请输入一个数字:"); int i = input.nextInt(); if(i==1){ System.out.println("x="+i); }else if(i==5){ System.out.println("x="+i); }else if(i==10){ System.out.println("x="+i); }else{ System.out.println("x=none"); } } }
package doom2; import java.util.Scanner; public class thefourweekwork2{ public static void main(String[] args) { // TODO Auto-generated method stub Scanner input =new Scanner(System.in); System.out.print("请输入一个数字:"); int i = input.nextInt(); switch(i){ case 1: System.out.println("x="+i); break; case 5: System.out.println("x="+i); break; case 10: System.out.println("x="+i); break; default: System.out.println("x=none"); break; } } }
package doom2; import java.util.Scanner; public class thefourweekwork3 { public static void main(String[] args) { // TODO Auto-generated method stub Scanner input =new Scanner(System.in); System.out.print("请输入一个数字:"); int i = input.nextInt(); if(i%5==0&&i%6==0){ System.out.println(i+"可以被5和6同时整除"); }else if(i%5==0&&i%6!=0){ System.out.println(i+"只能被5整除"); }else if(i%6==0&&i%5!=0){ System.out.println(i+"只能被6整除"); }else if(i%6!=0&&i%5!=0){ System.out.println(i+"不能被5和6整除"); } } }
package doom2; import java.util.Scanner; public class thefourweekwork4 { public static void main(String[] args) { // TODO Auto-generated method stub Scanner input =new Scanner(System.in); System.out.print("请输入一个0-100之间的分数:"); int i = input.nextInt(); if(i>100){ System.out.println("输入的值无效"); }else if(i>=90){ System.out.println("A级别"); }else if(i>=80){ System.out.println("B级别"); }else if(i>=70){ System.out.println("C级别"); }else if(i>=60){ System.out.println("D级别"); }else if(i<60){ System.out.println("E级别"); } } }
package doom2; import java.util.Scanner; public class thefourweekwork5 { public static void main(String[] args) { // TODO Auto-generated method stub Scanner input = new Scanner(System.in); System.out.print("请输入第一个数X:"); int a = input.nextInt(); System.out.println(); System.out.print("请输入第二个数Y:"); int b = input.nextInt(); System.out.println(); System.out.print("请输入第三个数Z:"); int c = input.nextInt(); if(a>b&&b>c){ System.out.println(c+"<"+b+"<"+a); }else if(a>c&&c>b){ System.out.println(b+"<"+c+"<"+a); }else if(b>a&&a>c){ System.out.println(c+"<"+a+"<"+b); }else if(b>c&&c>a){ System.out.println(a+"<"+c+"<"+b); }else if(c>a&&a>b){ System.out.println(b+"<"+a+"<"+c); }else if(c>b&&b>a){ System.out.println(a+"<"+b+"<"+c); } } }
标签:eth generate highlight Stub int png 第四周 一个 class
原文地址:https://www.cnblogs.com/a000/p/12573192.html