Created
November 1, 2019 15:24
-
-
Save leequixxx/15958f19786bf987d2d4a17354604c27 to your computer and use it in GitHub Desktop.
Лабалаторная работа 3 (Часть 2). Задание 13.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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