Posted On: Jan 08, 2021
Simple Java Program to find the Greatest/ largest number among 3 numbers
import java.util.Scanner; public class Greatest_Number { public static void main(String[] args) { int x, y, z; Scanner s = new Scanner(System.in); System.out.print("Enter the first number:"); x = s.nextInt(); System.out.print("Enter the second number:"); y = s.nextInt(); System.out.print("Enter the third number:"); z = s.nextInt(); if(x > y && x > z) { System.out.println("Greatest number is:"+x); } else if(y > z) { System.out.println("Greatest number is:"+y); } else { System.out.println("Greatest number is:"+z); } } }
Output
Enter the first number:20 Enter the second number:37 Enter the third number:45 Greatest number is:45
Never Miss an Articles from us.
...
In SQL, normalization of data is a process through with data is organized in tables used for the reduction of redundancy and dependency of data. It divides large tables into smaller ones using some se...
Difference between Class and object In JAVA:Class - A class is like a blueprint. It is the class with the help of which objects are created. The class holds together data and methods in one single...