Advertisement
paulogp

Soma de numeros pares

Aug 7th, 2011
308
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.63 KB | None | 0 0
  1. { paulogp }
  2. { mac os 7 }
  3. program Ada14p;
  4.  
  5. uses
  6.     MemTypes, QuickDraw, OSIntf;
  7.  
  8. var
  9.     n, s: integer;
  10.     fim: string;
  11.  
  12. begin
  13.     repeat
  14.         clearscreen;
  15.         writeln('Programa: Soma de números pares!');
  16.         writeln('Paulo G.P.');
  17.         writeln('================================');
  18.         s:=0;
  19.         repeat
  20.             writeln;
  21.             write('Introduza n numero par (ímpar para terminar): ');
  22.             readln(n);
  23.             if (n mod 2) = 0 then s:= s + n;
  24.         until (n mod 2) <> 0;
  25.         writeln;
  26.         writeln('A soma dos números pares é ', s);
  27.         writeln;  
  28.         writeln;
  29.         Write('Repetir programa (S/N)? ');
  30.         readln(fim);
  31.         uprstring(fim, true);
  32.     until fim = 'N';
  33. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement