ДС
Дмитрий Суворов

Turbo Pascal СРОЧНО!!!

Вот прога длинная, но простая:

var a:integer;
begin
assign(input,'input.txt');
reset(input);
assign(output,'output.txt');
rewrite(output);
read(a);
if a=0 then write(3);
if a=1 then write(2.7);
if a=2 then write(2.72);
if a=3 then write(2.718);
if a=4 then write(2.7183);
if a=5 then write(2.71828);
if a=6 then write(2.718282);
if a=7 then write(2.7182818);
if a=8 then write(2.71828183);
if a=9 then write(2.718281828);
if a=10 then write(2.7182818285);
if a=11 then write(2.71828182846);
if a=12 then write(2.718281828459);
if a=13 then write(2.7182818284590);
if a=14 then write(2.71828182845905);
if a=15 then write(2.718281828459045);
if a=16 then write(2.7182818284590452);
if a=17 then write(2.71828182845904524);
if a=18 then write(2.718281828459045235);
if a=19 then write(2.7182818284590452354);
if a=20 then write(2.71828182845904523536);
if a=21 then write(2.718281828459045235360);
if a=22 then write(2.7182818284590452353603);
if a=23 then write(2.71828182845904523536029);
if a=24 then write(2.718281828459045235360288);
if a=25 then write(2.7182818284590452353602875);
end.

Вопрос:
почему если у меня, например в input.txt число 13, выводиться вот это " 2.7182818285E+00"?

Manunich, спасибо, забыл совсем...

ЛШ
Лена Шаймардянова

Извращенцы 🙂
2.7182818284590452353602875 - это число e 😵 => exp(1) в Pascal + прочитайте про формат вывода в Pascal (это то что после : стоит, он сам округлит число до нужного знака)

WriteLn(exp(1):0:a);

Проверяем результат:
a:=0 -> 3
a:=1 -> 2.7
и т. д.

P.S:
Число е
Pascal - вывод, формат вывода

КЛ
Ксюшка Лукичева

Если тебя такое "решение" устраивает, то выводи это число в кавычках
Вот эквивалент твоей программе, но работающий правильно:
var a:integer;
const e='2.7182818284590452353602875';
begin
assign(input,'input.txt');reset(input);
assign(output,'output.txt');rewrite(output);
read(a);
if a=0 then write(3) else write(copy(e,1,a+2));
end.

Похожие вопросы
Посмотрите пожалуйста в чем здесь ошибка (Turbo Pascal) Срочно!)))
Помогите в Turbo Pascal!
Вопрос по TURBO pascal.
Помогите пожалуйста! Срочно!!! Turbo Pascal
Программирование в turbo pascal
Вопрос по Turbo Pascal
Задачка по Turbo Pascal
Помогите! Turbo Pascal.
программа на Turbo Pascal
Помогите срочно решить задачи в Turbo pascal