Lab If-Else (2)
已完成
import javax.swing.JOptionPane;
public class q1
{
public static void main(String[] args)
{
String myString=JOptionPane.showInputDialog("Enter a number: ");
int n = Integer.parseInt(myString);
if(n<0){
System.out.println("n<0,n= " +n+ " , ");
}
else if(n>=0 & n<100){
System.out.println("0<=n<100,n= " +n+ " , ");
}
else if( 100<=n )
{
System.out.println("n>=100,n= " +n+ " , ");
}
System.exit(0);
}
}
import javax.swing.JOptionPane;
public class q1
{
public static void main(String[] args)
{
String myString=JOptionPane.showInputDialog("Enter a number: ");
int n = Integer.parseInt(myString);
if(n<0){
System.out.println("n<0,n= " +n+ " , ");
}
else if(n>=0 & n<100){
System.out.println("0<=n<100,n= " +n+ " , ");
}
else if( 100<=n )
{
System.out.println("n>=100,n= " +n+ " , ");
}
System.exit(0);
}
}
0 Comments:
張貼留言
<< Home