Computer Science, asked by alivia07, 11 months ago

Write a program in Java to input 2 nos. and find out the greater no. Its urgent and fastest will be marked brainliest.​

Answers

Answered by afsalak005
1

Answer:import java.util.Scanner;

public class JavaProgram

{

   public static void main(String args[])

   {

       int a, b, big;

       Scanner scan = new Scanner(System.in);

 

       System.out.print("Enter Two Number : ");

       a = scan.nextInt();

       b = scan.nextInt();

 

       if(a>b)

       {

           big = a;

       }

       else

       {

           big = b;

       }

 

       System.out.print("Largest of Two Number is " +big);

   }

}

Explanation:

Answered by nilesh102
0

hi mate,

  • Answer : main buttonbutton
  • Answer : main buttonbuttonJava Program to Find Largest of Two Numbers
  • « Previous ProgramNext Program »
  • Find Largest of Two Numbers
  • To find the largest number of/in two numbers in Java Programming, you have to ask to the user to enter the two number to start checking which one is larger to display the largest number on the screen as shown in the following program.
  • Java Programming Code to Find Largest of Two Numbers
  • Java Programming Code to Find Largest of Two NumbersFollowing Java Program ask the user to enter the two numbers, to find the greatest/largest between the two numbers, then display the result on the screen:
  • main button button
  • Java Program to Find Largest of Two Numbers
  • « Previous ProgramNext Program »
  • « Previous ProgramNext Program »Find Largest of Two Numbers
  • « Previous ProgramNext Program »Find Largest of Two NumbersTo find the largest number of/in two numbers in Java Programming, you have to ask to the user to enter the two number to start checking which one is larger to display the largest number on the screen as shown in the following program.
  • Java Programming Code to Find Largest of Two Numbers
  • Java Programming Code to Find Largest of Two NumbersFollowing Java Program ask the user to enter the two numbers, to find the greatest/largest between the two numbers, then display the result on the screen:

/* Java Program Example - Find Largest of Two Numbers */

import java.util.Scanner;

public class JavaProgram

{

public static void main(String args[])

{

int a, b, big;

Scanner scan = new Scanner(System.in);

System.out.print("Enter Two Number : ");

a = scan.nextInt();

b = scan.nextInt();

if(a>b)

{

big = a;

}

else

{

big = b;

}

System.out.print("Largest of Two Number is " +big);

}

}

When the above Java Program is compile and executed, it will produce the following output. Above Java Programming Example Output (largest = b)

Above Java Programming Example Output (largest = a):

i hope it helps you.

Attachments:
Similar questions