If_Else_2
import javax.swing.JOptionPane;
public class If_Else_2
{
public static void main(String[] args)
{
String nString=JOptionPane.showInputDialog(" Enter a number: ");
int num=Integer.parseInt(nString);
System.out.println("The number is "+num);
if(num<0)
{
System.out.println(num+"<0");
}
else if((num>=0)&&(num<100))
{
System.out.println("0<="+num+"<100");
}
else if(num>=100)
{
System.out.println(num+"<=100");
}
System.exit(0);
}
}
0 Comments:
張貼留言
<< Home