Tuesday, 16 January 2018

Write a Java program to find largest number among three .

package com.tutorial4u;

public class LargestAmongThreeNumbers {
       public static void main(String[] args) {
             int a = 10;
             int b = 50;
             int c = 30;
             if(a>b && a>c){
                    System.out.println("a is largest number.");
             }else if(a<b && b>c){
                    System.out.println("b is largest number");
             }else if(a < c && b <c){
                    System.out.println("c is largest number");
             }else{
                    System.out.println(" a , b , c are same");
             }
       }
}


Output :


b is largest number

No comments:

Post a Comment

No of Occurrence in Array

package com.tutorial4u; import java.util.HashMap; /************************************************************  No of Occurrence in Array...