boucle java utilisant l'utilisateur d'entrée

import java.util.Scanner;

public class loop {
    public static void main(String[] args) {
        System.out.println("How much do you wanna make loop: "); // asking how many times u wanna loop
        try (Scanner sc = new Scanner(System.in)) {
            int x    = sc.nextInt();
            for (int i = 1; i < x; i++) {   // this code make ur loop starts with 1 and end by ur answer -1.
                System.out.println("loop "+i+" times"); // this will print out ur result
            }
            
            }
        }
    }
 
Paimon