Advertisement
paulogp

Triangulo de numeros

Aug 7th, 2011
201
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.76 KB | None | 0 0
  1. { paulogp }
  2. { mac os 7 }
  3. program Ada12p;
  4.  
  5. uses
  6.     MemTypes, QuickDraw, OSIntf;
  7.  
  8. const
  9.     MAX = 17;
  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!');
  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.         write;
  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);
  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