最大公约数 while语句hvar a,b,c:longint;beginwrite('a,b=');readln(a,b);while b>0 do beginc:=a mod b;a:=b;b:=c;endwrite(a);end.while b>0 do 中b>0 为什么help!
来源:学生作业帮助网 编辑:作业帮 时间:2024/06/24 01:38:56
![最大公约数 while语句hvar a,b,c:longint;beginwrite('a,b=');readln(a,b);while b>0 do beginc:=a mod b;a:=b;b:=c;endwrite(a);end.while b>0 do 中b>0 为什么help!](/uploads/image/z/1582580-20-0.jpg?t=%E6%9C%80%E5%A4%A7%E5%85%AC%E7%BA%A6%E6%95%B0+while%E8%AF%AD%E5%8F%A5hvar+a%2Cb%2Cc%3Alongint%3Bbeginwrite%28%27a%2Cb%3D%27%29%3Breadln%28a%2Cb%29%3Bwhile+b%3E0+do+beginc%3A%3Da+mod+b%3Ba%3A%3Db%3Bb%3A%3Dc%3Bendwrite%28a%29%3Bend.while+b%3E0+do+%E4%B8%ADb%3E0+%E4%B8%BA%E4%BB%80%E4%B9%88help%21)
最大公约数 while语句hvar a,b,c:longint;beginwrite('a,b=');readln(a,b);while b>0 do beginc:=a mod b;a:=b;b:=c;endwrite(a);end.while b>0 do 中b>0 为什么help!
最大公约数 while语句
hvar a,b,c:longint;
begin
write('a,b=');
readln(a,b);
while b>0 do begin
c:=a mod b;
a:=b;
b:=c;
end
write(a);
end.
while b>0 do 中b>0 为什么
help!
最大公约数 while语句hvar a,b,c:longint;beginwrite('a,b=');readln(a,b);while b>0 do beginc:=a mod b;a:=b;b:=c;endwrite(a);end.while b>0 do 中b>0 为什么help!
b==0,不就是除尽了吗,这时就应该退出循环,打印最后那个a了