Share your repls and programming experiences

← Back to all posts
Java program to find largest of three numbers using nested if
RaghunathThilag (1)

Java program to find largest of three numbers using nested if. In java programming for beginners, the largest number program compares numbers to select the largest number in a given number. This program will check the which is largest number among these three.

public class Main
{
public static void main(String[] args)
{
double a = 500, b = 1000, c = 1500;
if( a >= b && a >= c)
System.out.println(a + " largest number");
else if (b >= a && b >= c)
System.out.println(b + " largest number");
else
System.out.println(c + " largest number");
}
}
Output

1500 is largest number

Link: https://inlarn.com/java-program-to-find-largest-of-three-numbers-using-nested-if/