import java.util.*;
public class Main {
// Se corrigió el nombre, el parámetro 'n' y la sintaxis del while
public static void examen_1(int n) {
int a = 1, b = 1;
while (b <= n) {
System.out.println(a + ","); // Se añadió el '+'
a = a * 2;
b = b + 1;
}
System.out.println("XXXXXXXX");
}
public static void main(String[] args) throws Exception {
// Al ser un método estático, puedes llamarlo directamente sin el 'new'
examen_1(5);
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: