关于Turbo Pascal的难题08/27

来源:百度知道 编辑:UC知道 时间:2024/06/02 09:40:19
读入三个数,按由打到小的顺序输出。(两种方法做):
a)嵌套条件;
b)复合条件。
不用复合了,只写嵌套条件的就可以。。。

program ex8;
var a,b,c,t:integer;
begin
read(a,b,c);
if b>a then
begin
t:=a;
a:=b;
b:=t;
end;
if c>a then
begin
t:=a;
a:=c;
c:=t;
end;
if c>b then
begin
t:=b;
b:=c;
c:=t;
end;
write(a,b,c);
end.

37030319970528的答案很全了

用循环啊!!!!!!!!!

var i,j,x:integer;
a:array[1..3]of integer;
begin
for i:=1 to 3 do read(a[i]);
for i:=1 to 2 do
for j:=i+1 to 3 do
if a[j]>a[i] then
begin
x:=a[i];a[i]:=a[j];a[j]:=x;
end;
for i:=1 to 3 do write(a[i],' ');
end.

看,又短又简单。不懂问我。选我的做最佳答案吧!!!!

这题不属于难题----鉴定完毕。