Написать программу на языке Паскаль. Даны три действительные числа. Сложить те из них, значения которых не отрицательны.
Ответы на вопрос
Ответил TaTaPmember
0
program chisl;
var a,b,c,d:integer;
begin
write('Введите a = ' );
readln(a);
if a>=0 then d:=d+a;
write('Введите b = ' );
readln(b);
if b>=0 then d:=d+b;
write('Введите c = ' );
readln(c);
if c>=0 then d:=d+c;
writeln(d);
end.
var a,b,c,d:integer;
begin
write('Введите a = ' );
readln(a);
if a>=0 then d:=d+a;
write('Введите b = ' );
readln(b);
if b>=0 then d:=d+b;
write('Введите c = ' );
readln(c);
if c>=0 then d:=d+c;
writeln(d);
end.
Ответил TaTaPmember
0
ВОт так вернее
Ответил TaTaPmember
0
черд
Ответил TaTaPmember
0
program chisl;
var a,b,c,d:integer;
begin
write('Введите a = ' );
readln(a);
if a>=0 then d:=d+a;
write('Введите b = ' );
readln(b);
if b>=0 then d:=d+b;
write('Введите c = ' );
readln(c);
if c>=0 then d:=d+c;
write('Сумма положительных чисел равна ',d)
end.
var a,b,c,d:integer;
begin
write('Введите a = ' );
readln(a);
if a>=0 then d:=d+a;
write('Введите b = ' );
readln(b);
if b>=0 then d:=d+b;
write('Введите c = ' );
readln(c);
if c>=0 then d:=d+c;
write('Сумма положительных чисел равна ',d)
end.
Ответил dimanzare
0
спасибо
Ответил Pashq4
0
var a, b, c, rez: real;
begin
write('Введите число А: ');
readln(a);
write('Введите число B: ');
readln(b);
write('Введите число C: ');
readln(c);
if (a >= 0) and (b >= 0) and (c >= 0) then rez := a + b + c;
if (a >= 0) and (b >= 0) then rez := a + b;
if (a >= 0) and (c >= 0) then rez := a + c;
if (b >= 0) and (c >= 0) then rez := b + c;
if (a <= 0) and (b <= 0) then rez := c;
if (b <= 0) and (c <= 0) then rez := a;
if (a <= 0) and (c <= 0) then rez := b;
if (a <= 0) and (b <= 0) and (c <= 0) then rez := 0;
writeln(rez);
end.
Громоздко, но, думаю, покатит
begin
write('Введите число А: ');
readln(a);
write('Введите число B: ');
readln(b);
write('Введите число C: ');
readln(c);
if (a >= 0) and (b >= 0) and (c >= 0) then rez := a + b + c;
if (a >= 0) and (b >= 0) then rez := a + b;
if (a >= 0) and (c >= 0) then rez := a + c;
if (b >= 0) and (c >= 0) then rez := b + c;
if (a <= 0) and (b <= 0) then rez := c;
if (b <= 0) and (c <= 0) then rez := a;
if (a <= 0) and (c <= 0) then rez := b;
if (a <= 0) and (b <= 0) and (c <= 0) then rez := 0;
writeln(rez);
end.
Громоздко, но, думаю, покатит
Новые вопросы
Химия,
2 года назад
Русский язык,
2 года назад
Алгебра,
9 лет назад
Математика,
9 лет назад
Физика,
10 лет назад
Математика,
10 лет назад