I have a problem trying to output the result of a multiplication table made in CMD using a conditional loop. The code is the following:
@ECHO OFF & CLS
SET AUX=0
IF "%1" == "" (
SET /P num=Introduzca el numero a mostrar su tabla de multiplicar:
) ELSE (
SET num=%1
)
:sumarCont
SET /A AUX+=1
IF /I %AUX% LEQ 10 (
SET /A mul=%num%*%AUX%
ECHO %AUX% * %num% = %mul%
GOTO :sumarCont
)
@PAUSE > nul
The thing is that in the first loop interaction the variable called AUX won't update ending up in an output like this:
Introduzca el numero a mostrar su tabla de multiplicar: 5
1 * 5 =
2 * 5 = 5
3 * 5 = 10
4 * 5 = 15
5 * 5 = 20
6 * 5 = 25
7 * 5 = 30
8 * 5 = 35
9 * 5 = 40
10 * 5 = 45
I have tried using Delayed Expansion but the result remains the same. What am I missing?
Thanks in advance.