| pascal-kombinasi.pas |
|
1 program segitiga_pascal;
2 uses wincrt; 3 function faktorial(n:byte):real; 4 var i,z:word; 5 begin 6 if n = 0 then faktorial:=1 else 7 begin 8 z:=1; 9 for i:=1 to n do z:=z*i; 10 faktorial:=z; 11 end; 12 end; 13 function check(x,y:byte):real; 14 begin 15 y:=y-1; 16 check:=faktorial(x) / faktorial(y) / faktorial(x-y); 17 end; 18 var input,i,j:integer; 19 begin 20 writeln('Masukkan berapa tingkat segitiga pascal !'); 21 readln(input); 22 for i:=1 to input do 23 begin 24 for j:=1 to i+1 do 25 write(check(i,j):0:0,' '); 26 writeln; 27 end; 28 end. |
| 28 Lines | Download 'pascal-kombinasi.pas' | 486b |
Powered By GaMerZ File Explorer Version 1.20
Copyright © 2004-2010 Lester "GaMerZ" Chan, All Rights Reserved.
Page Generated In 0.01209 Seconds