Program Segitiga_pascal
kamus
i,j,n : Integer
p : array [1..50,1..50] of integer
Algoritma
read(n);
for
i ß 1 to n do
for j ß 1 to i do
if (j =1) or (j = i)
then
p[i,j] ß 1
then
p[i,j] ß 1
else
p[i,j] ß p[i-1,j] + p[i-1,j-1]
write(p[i,j],' ')
Endif
Endfor
Endfor
Endfor
Terdalam (+)
Tmin = 0
Tmax = n - 2
Tavg = (n – 2) / 2
≈ n – 2
Tidak ada komentar:
Posting Komentar