Find largest of three numbers in java


In this core java programming tutorial we will write a program to Find largest of three numbers in java.



Write a program to find largest of three numbers in java.



Full Program/SourceCode / Example to Find largest of three numbers in java >
/** Copyright (c), AnkitMittal www.JavaMadeSoEasy.com */
public class LargestOfThreeExample {
   public static void main(String[] args) {
         
     int a, b, c;
     a = 10;
     b = 13;
     c = 71;
  
     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.


So, in this core java programming tutorial we wrote a program how to Find largest of three numbers in java.

Previous program                                                                  Next program




Having any doubt? or you you liked the tutorial! Please comment in below section.
Please express your love by liking JavaMadeSoEasy.com (JMSE) on facebook, following on google+ or Twitter.



RELATED LINKS>


>Pattern/Pyramid generating programs



eEdit
Must read for you :