Одноклеточная амёба каждые три часа делится на 2 клетки.Составьте алгоритм вычисления времени,через которое будет X амёб.Через паскаль с помощью цикла while.
program AmoebaDivision; var X, time, count: Integer; begin Write′Enterthenumberofamoebas:′'Enter the number of amoebas: '′Enterthenumberofamoebas:′; ReadlnXXX;
time := 0; count := 1;
while count < X do begin time := time + 3; count := count * 2; end;
Writeln′After′,time,′hourstherewillbe′,X,′amoebas.′'After ', time, ' hours there will be ', X, ' amoebas.'′After′,time,′hourstherewillbe′,X,′amoebas.′; end.
program AmoebaDivision;
var
X, time, count: Integer;
begin
Write′Enterthenumberofamoebas:′'Enter the number of amoebas: '′Enterthenumberofamoebas:′;
ReadlnXXX;
time := 0;
count := 1;
while count < X do
begin
time := time + 3;
count := count * 2;
end;
Writeln′After′,time,′hourstherewillbe′,X,′amoebas.′'After ', time, ' hours there will be ', X, ' amoebas.'′After′,time,′hourstherewillbe′,X,′amoebas.′;
end.