Answer the question
In order to leave comments, you need to log in
The else statement doesn't work in pascal why?
It says "Program1.pas(21) : 'else' encountered but operator expected"
program test;
var
sum: real;
percent: real;
period: integer;
profit: real;
result: real;
begin
writeln('Вычисление дохода по в кладу в банке');
writeln;
write('Сумма (руб.) ->');
readln(sum);
write('Срок вклада (дней) ->');
readln(period);
if sum > 5000 then
percent := 0.95;
else
pecent := 0.08;
profit := sum * percent/365 * period;
result := sum +profit;
writeln('Сумма в конце срока вклады: ',
result:6:2, руб.');
writeln('Доход: ', profit:6:2, ' руб.');
write('Для завершения работы нажмите <Enter>');
readln;
end.
Answer the question
In order to leave comments, you need to log in
How did you determine what wasn't working?
It's not Else that doesn't work for you, but there are a lot of grammatical errors.
No need to put a semicolon after the first
percent := 0.95
in the second pecent := 0.08; you need to write percent and not pecent
in the line
writeln('Amount at the end of the term deposits: ',
result:6:2, rub.');
You are missing a single quote before the rub.
Is it really that hard to be careful?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question