Rotate your phone or change to desktop for better experience

Rotate your phone or change to desktop for better experience

Pgm 1 || Program to assign two integer values to X and Y. Using the if statement the output of the program should display a message whether X is greater than Y.

 import java.util.*;

public class Pgm1

{

public static void main(String[] args)

{

Scanner in = new Scanner(System.in);

System.out.print("Input the first number : ");

int x = in.nextInt();


System.out.print("Input the second number: ");

int y = in.nextInt();


if(x > y)

{

System.out.print("X is Greater:"+x);

}

else

{

System.out.print("Y is Greater:"+y);

}


}

}

Post a Comment

0 Comments