Java -Produkt 1 bis n

public class Main {
  public static void main(String[] args) {
    var scanner = new java.util.Scanner(System.in);
    System.out.print("What is n? ");
    int n = scanner.nextInt();
    int product = 1;
    for (int i = 2; i <= n; ++i) {
      product *= i;
    }
    System.out.println("The product of 1..n is " + product);
  }
}
Merlin4 (ranken)