Skip to content

Instantly share code, notes, and snippets.

@leequixxx
Created November 1, 2019 15:24
Show Gist options
  • Save leequixxx/15958f19786bf987d2d4a17354604c27 to your computer and use it in GitHub Desktop.
Save leequixxx/15958f19786bf987d2d4a17354604c27 to your computer and use it in GitHub Desktop.
Лабалаторная работа 3 (Часть 2). Задание 13.
program task3213;
{$MODE DELPHI}
uses SysUtils;
const DEPOSIT: real = 1000;
const WITHDRAW: real = 1100;
var Percents: real;
var Sum: real;
var Months: integer;
begin
while true do
begin
try
Write('Please, enter percents value (deposit: ', DEPOSIT:1:2, '): ');
ReadLn(Percents);
if (Percents <= 0) or (Percents >= 25) then
begin
WriteLn('Percents value should be between 0 and 25 (not inclusive)!');
Continue;
end;
Break;
except
on E: Exception do
begin
WriteLn('Percents value should be a number!');
Continue;
end;
end;
end;
Sum := DEPOSIT;
Months := 0;
repeat
Months := Months + 1;
Sum := Sum * (1 + Percents / 100);
until Sum > WITHDRAW;
WriteLn('Months count: ', Months);
WriteLn('Sum: ', Sum:1:2);
WriteLn('Enter something for exit...');
ReadLn;
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment