Problem 1: Input and Output

Create a program that will let the user enter four numbers. If the first number is greater than the second number, and the third number is less than the fourth number, or, if the first number is greater than the second number, and the third number is less than one, display TRUE. Else, display FALSE.


import java.io.*;
public class New{
public static void main (String args[]) throws IOException
{
DataInputStream n=new DataInputStream (System.in);
int a=0;
int b=0;
int c=0;
int d=0;
System.out.println("Enter First Number: ");
a=Integer.parseInt (n.readLine());
System.out.println("Enter Second Number: ");
b=Integer.parseInt (n.readLine());
System.out.println("Enter Third Number: ");
c=Integer.parseInt (n.readLine());
System.out.println("Enter Fourth Number: ");
d=Integer.parseInt (n.readLine());
if (a>b && c<d || a >b && c<1)

System.out.println("TRUE");
else System.out.println("FALSE"); } }

No comments:

Post a Comment

Extended Search

Custom Search
Hello World