Advertisement
paulogp

Sequencia de numeros

Aug 7th, 2011
172
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.79 KB | None | 0 0
  1. { paulogp }
  2. Program Peda_09 (Input, Output);
  3.  
  4. Uses
  5.     WinCrt;  
  6.  
  7. Var
  8.     Valor_Inicial, Incremento, Soma: Integer;
  9.     Fim: Char;
  10.  
  11. Begin
  12.     Repeat
  13.         ClrScr;
  14.         WriteLn('Programa: Sequencia de numeros.');
  15.         WriteLn('~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~');
  16.         Repeat
  17.             WriteLn;
  18.             Write('Introduza o valor inicial [10,20]: ');
  19.             ReadLn(Valor_Inicial);
  20.         Until (Valor_Inicial >= 10) and (Valor_Inicial <= 20);
  21.         Repeat
  22.             WriteLn;
  23.             Write('Introduza o incremento [ 5,10]: ');
  24.             ReadLn(Incremento);
  25.         Until (Incremento >= 5) and (Incremento <= 10);
  26.         Soma:= Valor_Inicial;
  27.         WriteLn;
  28.         While Soma <= 1000 do
  29.         Begin
  30.             WriteLn(Soma);
  31.             Soma:= Soma + Incremento;
  32.         End;
  33.         WriteLn;
  34.         WriteLn;
  35.         Write('Repetir programa (S/N)? ');
  36.         Fim:=ReadKey;
  37.     Until UpCase(Fim)='N';
  38.     DoneWinCrt;
  39. End.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement