Hi folk,
I have a code for pascal triangle
@echo off
setlocal ENABLEDELAYEDEXPANSION
Title Pascal's Triangle
:Begin
cls
(set n=)
set /p "n=Input (?? Lines) : "
if not defined n goto :Begin
(set /a nspace=n-1)
(set temp_var=!nspace!)
for /L %%a in (1,1,!n!) do (
for /L %%n in (1,1,!nspace!) do (
for /F "Delims=" %%s in ('echo. ') do <nul set /p "=%%s"
)
(set /a nspace-=1)
(set Bil[%%a][1]=1)
(set Bil[%%a][%%a]=1)
if %%a gtr 2 for /L %%x in (2,1,!temp_var!) do (
set /a "prev=%%a-1"
set /a "prev_coloum=%%x-1"
call set "temp_1=%%Bil[!prev!][!prev_coloum!]%%"
call set "temp_2=%%Bil[!prev!][%%x]%%"
set /a "Bil[%%a][%%x]=temp_1+temp_2"
)
for /L %%b in (1,1,%%a) do <nul set /p "=!Bil[%%a][%%b]! "
echo.
)
pause>nul
goto :Begin
:END
It is using concept of array.
So, I am confused with each lines.
Can any comment on each lines and explain this to me.
BC_programmer, Marviland, Victoria.
Hope to see your comments.
Thanks and regards
vish