import java.util.Scanner;
public class switchexercise02
{
public static void main(String[]args){
Scanner myscanner =new Scanner(System.in);
System.out.println("please input your score");
int score =myscanner.nextInt();
if (score>=0 && score <=100){
switch ((int)(score/ 60)){
case 1:
System.out.println("pass");
break;
case 0:
System.out.println("fail");
break;
}
}
else{
System.out.println("the number should be within 0-100");
}
}
}
转码作业2 : Java使用if-else和switch分析输入的成绩是否及格
最新推荐文章于 2023-07-12 14:23:21 发布