Computer Science, asked by himakshisahai, 4 months ago

A program that receives two numbers numl and num2 from the user. Display the larger
number. If the numbers are the same, display that the numbers are the same.​

Answers

Answered by amansarrafas24payxgs
0

Answer:

import java.util.*;

class Larger

{

public void main()

{

Scanner sc = new Scanner (System.in);

System.out.println("Enter a num1: ");

int num1 = sc.nextInt();

System.out.println("Enter a num2: ");

int num2 = sc.nextInt();

if(num1 > num2)

{

System.out.println(num1 + " is larger");

}

else if(num1 < num2)

{

System.out.println(num2 + " is larger");

}

else

{

System.out.println("The numbers are the same.");

}

}

}

I hope you find it useful... If you have any query do comment, I will try to solve it...

Similar questions