package lab3;

import java.util.Scanner;

public class Example4 {
    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);

        System.out.print("Enter first number: ");
        int a = in.nextInt();

        System.out.print("Enter second number: ");
        int b = in.nextInt();

        int min = Math.min(a, b);
        int max = Math.max(a, b);

        // ===== Version 1: for loop =====
        System.out.println("Using for loop:");
        for (int i = min; i <= max; i++) {
            System.out.print(i + " ");
        }
        System.out.println();

        // ===== Version 2: while loop =====
        System.out.println("Using while loop:");
        int i = min;
        while (i <= max) {
            System.out.print(i + " ");
            i++;
        }
        System.out.println();

        // ===== Version 3: do-while loop =====
        System.out.println("Using do-while loop:");
        i = min;
        do {
            System.out.print(i + " ");
            i++;
        } while (i <= max);

        in.close();
    }
}
