//find greatest among two numbers

import java.util.Scanner;

public class Numbers {

    public static void main(String[] args) {
        int num1, num2;
        Scanner ip = new Scanner(System.in);
        System.out.print("Enter num1: ");
        num1 = ip.nextInt();
        System.out.print("Enter num2: ");
        num2 = ip.nextInt();
        if (num1 > num2)
            System.out.println(num1 + " is greater that " + num2);
        else if (num2 > num1)
            System.out.println(num2 + " is greater that " + num1);
        else
            System.out.println("Both are same");

        ip.close();
    }

}



OUTPUT:
Enter num1: 35
Enter num2: 45
45 is greater that 35

 

相关文章:

  • 2021-11-25
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-03-04
猜你喜欢
  • 2021-05-04
  • 2021-07-26
  • 2022-12-23
  • 2022-12-23
  • 2021-10-05
  • 2022-01-20
  • 2022-12-23
相关资源
相似解决方案