If - Else 2
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.io.IOException;
public class I_E2 {
public static void main(String[] args)throws IOException {
BufferedReader Keyboard=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Please enter the number:");
int n=Integer.parseInt(Keyboard.readLine());
if (n<0)
System.out.println("n < 0");
else if ((0 <= n)&&(n< 100))
System.out.println("0 <= n < 100");
else {
System.out.println("n >= 100");
}
}
}
import java.io.InputStreamReader;
import java.io.IOException;
public class I_E2 {
public static void main(String[] args)throws IOException {
BufferedReader Keyboard=new BufferedReader(new InputStreamReader(System.in));
System.out.println("Please enter the number:");
int n=Integer.parseInt(Keyboard.readLine());
if (n<0)
System.out.println("n < 0");
else if ((0 <= n)&&(n< 100))
System.out.println("0 <= n < 100");
else {
System.out.println("n >= 100");
}
}
}
0 Comments:
張貼留言
<< Home