Computer Science, asked by jaiswalishita009, 8 hours ago

Write a program to input any 3-digit integer number and display the largest number using all the digits of the given number.
Example:
Input: Enter a 3-digit number…482
Output: Given number…483
Largest number…843​

Answers

Answered by ritikasingh9940
3

Answer:

import java.util.Scanner;

public class KboatGreatestNumber

{

   public static void main(String args[]) {

       

       Scanner in = new Scanner(System.in);

       

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

       int a = in.nextInt();

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

       int b = in.nextInt();

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

       int c = in.nextInt();

       

       int g = Math.max(a, b);

       g = Math.max(g, c);

       

       int s = Math.min(a, b);

       s = Math.min(s, c);

       

       System.out.println("Greatest Number = " + g);

       System.out.println("Smallest Number = " + s);

Similar questions