Computer Science, asked by ruchi81982, 6 months ago

Write a java program.to enter a 3-digit.number and for. The largest number from.it .finally display the result




Help me

Answers

Answered by devanujroy89
0

Answer:

import java.util.Scanner;

public class xyz

{

   public static void main(String []args)  

   {

       Scanner sc = new Scanner(System.in);

       System.out.println("enter the digits of the three-digit number seperately");

       int num1 = sc.nextInt();

       int num2 = sc.nextInt();

       int num3 = sc.nextInt();

       int x;

       if (num1>num2)

       

        x = num1;

       else  

       x= num2;

       

       if (x>num3)

       System.out.println("the largest digit is ="+x);

       else

       System.out.println("the largest digit is ="+num3);

   }            

}

Similar questions