echo off setlocal enabledelayedexpansion cls echo Complete: 00 %% set cnt=0 set old=0 for /l %%a in (0,1,9) do ( for /l %%b in (0,1,9) do ( for /l %%c in (0,1,9) do ( set /a left=%%a+%%b+%%c for /l %%d in (0,1,9) do ( for /l %%e in (0,1,9) do ( set /a cmp=left-%%d-%%e if !cmp! geq 0 ( if !cmp! leq 9 ( set /a cnt+=1 if not !old!==%%b ( set old=%%b cls echo Complete: %%a%%b %% ) ) ) ) ) ) ) ) cls echo Result: %cnt%