Lab If-Else (2)
package aaa;
import javax.swing.JOptionPane;
public class aaa
{
public static void main(String[] args)
{
String myString=JOptionPane.showInputDialog("Enter a number: ");
int n = Integer.parseInt(myString);
if(n<0){ n= " +n+ ">=0 & n<100){
System.out.println("n介於0和100之間,n= " +n+ " , ");
}
else if( 100<=n )
{
System.out.println("n大於100,n= " +n+ " , ");
}
}
}
執行結果
0 Comments:
Post a Comment
<< Home