Write a program Find The largest number among threeFind the Largest number among three numbers which is input from user.
ALGORITHM:-
step 1 : Start
step 2 : import java.io.* Package
step 3 : Create A class
step 4 : Define the main method
step 5 : Input Three Number from user
step 6 : Find the Largest Number
step 7 : Print The largest Number
step 8 : Terminate
PROGRAM CODE:-
import java.io.*;
class largest
{
public static void main(String rags[])
{
Console con=System.console();
int a,b,c,large;
//Take the input from user
System.out.println("Enter First Number: ");
a=Integer.parseInt(con.readLine());
System.out.println("Enter Second Number: ");
b=Integer.parseInt(con.readLine());
System.out.println("Enter Third Number: ");
c=Integer.parseInt(con.readLine());
large=a;
if(b>a && b>c)
{
large=b;
}
else if(c>a && c>b)
{
large=c;
}
System.out.println("The Largest Number is: "+large);
}
}
OUTPUT:-
Enter First Number: 78
Enter Second Number: 23
Enter Second Number: 45
The Largest Number is: 78
Java program to find the largest number among three number which is input by user How to take input in java programming find the largest number How to input Integer value in java
ConversionConversion EmoticonEmoticon