16.ifelse句自由拓展

import java.util.*;//声明Scanner
public class Main {//类型
public static void main(String[]args){//入口
Scanner input = new Scanner(System.in);
System.out.println("请输入a值");
int custNo=input.nextInt();

if (custNo>1000&&custNo<2000){
System.out.print("大于1K");
}else if(custNo>2000&&custNo<3000){
System.out.println("大于2K");
}else if (custNo>3000){
System.out.print("大于3K");
}else{
System.out.print("一千以下的正整数");
}
}
}

 自由拓展

import java.util.*;//声明Scanner
public class Main {//类型
public static void main(String[]args){//入口
Scanner input = new Scanner(System.in);
System.out.println("请输入成绩");
int custNo=input.nextInt();

if (custNo>=90){
System.out.print("大于90,优秀");
}else if(custNo>=80){
System.out.println("大于80,良好");
}else if (custNo>=60){
System.out.print("大于60,中等");
}else{
System.out.print("小于60,差劲");
}
}
}

 

posted @ 2011-12-11 06:31  馨梦域名主机服务中心  阅读(229)  评论(0编辑  收藏  举报
官方推出免费静态网页空间,适合大企业展示和个人展示类空间。欢迎联系QQ908898668申请。