Tuesday, 17 November 2020

Java program to find out the largest number out of 3 numbers entered by the user.

import java.util.*;

public class Largest

{

public static void main(String args[]) 

{

Scanner in=new Scanner(System.in);

int N1,N2,N3;

System.out.println("Enter 3 Numbers");

N1=in.nextInt();

N2=in.nextInt();

N3=in.nextInt();

if(N1>N2&&N1>N3)

System.out.println(N1+" is the Greatest Number");

else if(N2>N1&&N2>N3)

System.out.println(N2+" is the Greatest Number");

else 

System.out.println(N3+" is the Greatest Number");

}

}


No comments:

Post a Comment

Java Program to count the total number of characters in a string

 //Java Program to count the total number of characters in a string import java.util.*; public class CountChars {     public static void mai...