Friday, October 8, 2021

Largest of Three Numbers in Java

 Machine Problem

 Write a Java program that finds largest of three numbers and then prints it. If the entered numbers are unequal then "numbers are not distinct" is printed.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod City I also accepting computer repair, networking, and Arduino Project development at a very affordable price. My website is www.jakerpomperada.blogspot.com and www.jakerpomperada.com

If you like this video please click the LIKE button, SHARE, and SUBSCRIBE to my channel.





Program Listing


/*

 * Largest_of_Three_Numbers.java

 * 

  Prof. Jake Roderiguez Pomperada, MAED-IT, MIT

  www.jakerpomperada.com  and www.jakerpomperada.blogspot.com

  jakerpomperada@gmail.com

  Bacolod City, Negros Occidental Philippines

 * 

 * Machine Problem

 * 

 * Write a Java program that finds largest of three numbers

and then prints it. If the entered numbers are unequal then "numbers are

not distinct" is printed.

 */


import java.util.Scanner;




class Largest_of_Three_Numbers


{


   public static void main(String args[])


   {


      int x=0, y=0, z=0;

      

       Scanner input = new Scanner(System.in);

       

       System.out.println("\n");

       System.out.println("\tLargest of Three Numbers in Java");

       System.out.println();


      System.out.println("Enter three integers ");


     x = input.nextInt();


      y = input.nextInt();


      z = input.nextInt();


 


      if ( x > y && x > z )


         System.out.println("First number is largest.");


      else if ( y > x && y > z )


         System.out.println("Second number is largest.");


      else if ( z > x && z > y )


         System.out.println("Third number is largest.");


      else   


         System.out.println("Entered numbers are not distinct.");

         

      System.out.println();

      System.out.println("\tEnd of Program");

      System.out.println("\n");


   }


}


No comments:

Post a Comment