RSS

program segitiga_pascal;

uses wincrt;
var
n,m,i,a,b,c:longint;d:real;
begin
      write('input: ');readln(n);
      for m:=0 to n do
      begin
           a:=1;b:=1;c:=1;
           for i:=1 to n do
           a:=a*i;
           for i:=1 to n-m do
           b:=b*i;
           for i:=1 to m do
           c:=c*i;
           begin
                d:=(a/(b*c));
                if n=m then
                write(d:0:0)
                else
                write(d:0:0,',');
           end;
     end;
end.

OUTPUT ;
 
 Gambar 1 Output Segitiga Pascal dari Inputan 5

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

0 comments: