Memaknai hidup untuk saling berbagi. Walaupun tidak berbentuk materi, tapi berbagi berupa ilmu dan informasi. Karena Informasi Tiada Henti







Saturday 3 January 2009

Segitiga Pascal

Uses

wincrt;

var num:array[1..100] of longint;

i,j,n,batas:integer;

begin

clrscr;

writeln(' Program Segitiga Pascal ');

writeln;

write(' Masukan Nilai N :');

readln(n);

num[1]:=1;

writeln(1);

for i:=1 to n do

begin

batas:=(i+1) div 2;

if not odd(i)then

num[batas+1]:=num[batas]*2;

for j:=batas down to 2 do

num[j]:=num[j]+num[j-1];

for j:=1 to batas do

write(num[j],' ');

if not odd(i)then write (num[batas+1],' ');

for j:=batas downto 1 do

write(num[j],' ');

writeln;

end;

readln;

end.


Like the Post? Do share with your Friends.

No comments:

Post a Comment

IconIconIconFollow Me on Pinterest

KOMPAS TEKNO

Page Rank

PageRank Checker

What's Hot