Tình giai thừa trong Pascal (n!)



program tinhgiaithu;
 uses crt;
  var n,i: integer;
        gt: longint;
begin
  write('Giai thua cua n='); readln(n);
    gt:=1;
  if N<0 then writeln(#7,'Khong duoc vi N<0')
    else
   begin
      if N>0 then
     for i:=1 to N do gt:=gt*i;
    writeln(N,'!=',gt);
   end;
  readln
end.

0 nhận xét:

Đăng nhận xét

Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by hoang ptit | Support for this Theme dohoavietnam