Java Program to print Greatest of two numbers

Java Program to print Greatest of two numbers 1. Java Program to print Greatest of two numbers using if Statement: Program: import java.io.*; import java.util.*; class GreatestOfTwo { public static void main(String args[]) { int num1=20, num2=55, max ; max=num2; if(num1>num2) { max=num1; } System.out.println(“The Greatest of two numbers is “+max); } } Output: The Greatest … Read more

Java Program to calculate Average of three numbers- 6 ways

Java Program to calculate Average of three numbers- 6 ways The java program to calculate average of three numbers has been written in five different ways such as Scanner class, direct value initialization, Buffered Reader class, Command Line argument, methods, and using Constructor. Java Program to calculate Average of three numbers- 6 ways are given below: … Read more