Showing posts with label Java Program to find largest of Three Numbers. Show all posts
Showing posts with label Java Program to find largest of Three Numbers. Show all posts

Tuesday, 29 May 2018

Java Program to find largest of Three Numbers



Sample Program:-


 public class LargestNumber {  
      public static void main(String[] args) {  
           int a, b, c;  
           a = 20;  
           b = 30;  
           c = 40;  
           if (a > b && a > c)  
                System.out.println("a is largest");  
           else if (a < b && b > c)  
                System.out.println("b is largest");  
           else if (a < c && b < c)  
                System.out.println("c is largest");  
           else  
                System.out.println("a, b, c are not different");  
      }  
 }  


Output:-


 c is largest  


Enjoy Coding.