I have a question, make the following program that returns the even numbers that are within a limit that the user grants by keyboard, is it possible some way for me to deploy, the number of even terms instead of those that Are they considered within the limit? example: Enter limit:
5
The even numbers are:
2,4,6,8,10
Instead of:
2, 4
Scanner sc = new Scanner (System.in);
int li=0;
System.out.println("Ingrese la cantidad de numeros pares: ");
li= sc.nextInt();
for (int i =2; i<= li; i++)
{
if(i%2==0)
{
System.out.print(i+ ", ");
}
}
System.out.println("");