小青蛙回来了pascal怎么做

来源:百度知道 编辑:UC知道 时间:2024/09/22 08:30:04
关于小青蛙爬井的故事,你应该早就听过了:井深10尺,小青蛙从井底向上爬,每个白天向上爬3尺,每个晚上又滑下来2尺,然后问你第几天它能爬上来。答案是第8天。
现在,那只著名的小青蛙又回来了,它现在每个白天已经可以向上爬 ( )尺了,当然,晚上还是要下滑 ( )尺的。如果告诉你井深 ( )尺,请计算一下,现在,它第几天可以爬上来。
要用pascal语言

program
frog;
var
n,m,day,h,i:integer;
BEGIN
write('Please enter the height of wells, the frog to climb every day, to the decline in the length (feet):');
read(h,n,m);
i:=i+n;
if n-m>0 then
begin
writeln('Can not go out of.');
exit;
end;
while h<10 do
begin
i:=i-m;
day:=day+1;
i:=i+n;
end;
writeln('The day is:'day+1);
END.

program exam1;
var a,b,c,d,e:integer;f,g:real;
begin
readln(a);
readln(b);
readln(c);
d:=c-a;
e:=a-b;
f:=d/e;
g:=f+1;
writeln(g);
end.
a为上爬 ( )尺
b为下滑 ( )尺
c为井深 ( )尺

-----------------
program frog;
var
h,day,a,b,i:integer;
begin
readln(a,b,h);
i:=0;
day:=0;
repeat
inc(i,a);
dec(i,b);
inc(day);
until i>=h;
write(day);
end.

说清楚点嘛 <