WAP to find largest among three numbers using scanner.

3 years ago
OOP Java

Compile code:

import java.util.Scanner;

public class Largestamongthreenumbers1{

    public static void main(String args[])

    {

        int a, b,c,Largest;

        Scanner scan = new Scanner(System.in);

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

        a = scan.nextInt();

        b = scan.nextInt();

        c=scan.nextInt();

        if(a>b&&a>c){

            Largest = a;}

        else if(b>a&&b>c){

            Largest = b;}

        else{

            Largest =c;

        }

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

    }

}

 

Output:

0
Dipti KC
Jan 8, 2023
More related questions

Questions Bank

View all Questions