Write a Java Program to Find the Largest Among Three Numbers
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
public class Largest { public static void main(String[] args) { double n1 = -4.5, n2 = 3.9, n3 = 2.5; if( n1 >= n2 && n1 >= n3) System.out.println(n1 + " is the largest number."); else if (n2 >= n1 && n2 >= n3) System.out.println(n2 + " is the largest number."); else System.out.println(n3 + " is the largest number."); } } |
1 thought on “Write a Java Program to Find the Largest Among Three Numbers”