Largest number from three numbers in JAVA programming


//This program show you how to get a largest number from three given number..... 
package SolveProblem;.////Package name

import java.util.Scanner;

public class LargestValut {

    public static void main(String[] args) {
        Scanner myScanner=new Scanner(System.in);
        int a,b,c;
       
        System.out.println("Enter three number : ");
        a=myScanner.nextInt();
        b=myScanner.nextInt();
        c=myScanner.nextInt();
        if (a>b) {
            if (a>c) {
                System.out.println("Large number is : "+a);
            } else {
                System.out.println("Large number is : "+c);
            }
        }
        else{
            if (b>c) {
                System.out.println("Large number is : "+b);
            }
            else{
                System.out.println("Large number is : "+c);
            }
        }
       
    }

}

No comments:

Post a Comment