Предмет: Информатика,
автор: eg9053374
Напишіть програму визначення моменту зустрічі двох автомобілів, якщо відома відстань між пунктами, звідки вони вийшли назустріч один одному одночасно, та їх швидкості. Паскаль
flash77779:
Виконав
Ответы
Автор ответа:
1
program CarsMeeting;
uses
SysUtils;
var
distance, speed1, speed2, time: double;
begin
Write('Enter the distance between the cars: ');
ReadLn(distance);
if (distance <= 0) then
begin
WriteLn('The distance must be positive');
Exit;
end;
Write('Enter the speed of the first car: ');
ReadLn(speed1);
if (speed1 <= 0) then
begin
WriteLn('The speed must be positive');
Exit;
end;
Write('Enter the speed of the second car: ');
ReadLn(speed2);
if (speed2 <= 0) then
begin
WriteLn('The speed must be positive');
Exit;
end;
time := distance / (speed1 + speed2);
WriteLn('The cars will meet in ', time:0:2, ' hours');
end.
Приложения:


Похожие вопросы
Предмет: Математика,
автор: silver5561
Предмет: Математика,
автор: ancenelena327
Предмет: Другие предметы,
автор: kopilovaviktoria93
Предмет: Химия,
автор: anastasia2018allo