Q.7 Write a java program to find the minimum of two number using the if…else statement.
Solution :-Â
public class AverageCalculator{
  public static void main(String[] args) {
    Scanner scanner = new Scanner(System.in);
    System.out.print(“Enter the first number: “);
    int num1 = scanner.nextInt();
    System.out.print(“Enter the second number: “);
    int num2 = scanner.nextInt();
    if (num1 < num2) {
      System.out.println(“The minimum number is: ” + num1);
    }Â
elseÂ
{
      System.out.println(“The minimum number is: ” + num2);
    }
Â
  }
}
Output :-Â