Advertisement
paulogp

Triangulo de numeros invertidos

Aug 7th, 2011
234
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.80 KB | None | 0 0
  1. { paulogp }
  2. { mac os 7 }
  3. program Ada13p;
  4.  
  5. uses
  6.     MemTypes, QuickDraw, OSIntf;  
  7.  
  8. const
  9.     MAX = 18;
  10.  
  11. var
  12.     i, j, n: integer;
  13.     fim: string;
  14.  
  15. begin
  16.     repeat
  17.         clearscreen;
  18.         writeln('Programa: Triângulo de números invertidos!');
  19.         writeln('Paulo G.P.');
  20.         writeln('==========================================');
  21.         repeat
  22.             writeln;
  23.             write('Introduza um valor no intervalo ]0,', MAX,']: ');
  24.             ReadLn(n);
  25.             writeln;
  26.             if (n <= 0) or (n > MAX)  then write('Atenção!!!');
  27.         until (n > 0) and (n <= MAX);
  28.         writeln;
  29.         for J:= n downto 1 do
  30.         begin
  31.             for i:= 1 to n do
  32.                 if i >= n - J + 1 then write(i: 4) else write('    ');
  33.             writeln;
  34.         end;
  35.         writeln;
  36.         writeln;  
  37.         writeln;
  38.         write('Repetir programa (S/N)? ');
  39.         readln(fim);
  40.         uprstring(fim, true);
  41.     until fim = 'N';
  42. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement