write a java program to find the largest of three numbers
Answers
Answer:
This is a Java Program to Find the Biggest of 3 Numbers.
Enter any three integer numbers as an input. Now we check the first number against the second and third number. If it false then we check for second number against third. If it is also false then accordingly third number will be declared the largest number of the given three numbers.
Here is the source code of the Java Program to Find the Biggest of 3 Numbers. The Java program is successfully compiled and run on a Windows system. The program output is also shown below.
Answer:
import java.io.*;
public class bigof3
{
public static void main(String[] args) throws IOException
{
InputStreamReader isr=new InputStreamReader(System.in);
BufferedReader abc= new BufferedReader(isr);
System.out.println("Enter the First Number");
int a=Integer.parseInt(abc.readLine());
System.out.println("Enter the Second Number");
int b=Integer.parseInt(abc.readLine());
System.out.println("Enter the Third Number");
int c=Integer.parseInt(abc.readLine());
if(a>b && a>c)
{
System.out.println("First number is the greatest");
}
else if(b>a && b>c)
{
System.out.println("Second number is the greatest");
}
else if (c>a && c>b)
{
System.out.println("Third number is the greatest");
}
}
}
Answerd by M.Mithul Pranav
Hope it helps