帮助解答PASCAL程序设计简单的几个题目。

来源:百度知道 编辑:UC知道 时间:2024/05/15 08:38:44
1.输入一个三位数整数,将它反向输出。例如输入127,输出应为721。
2.打印金字塔图形。
*
***
*****
*******
*********
3.输入10个数,将它们按从大到小的次序排序以后输出。(用冒泡法做)
4.输入a,b,c,计算m。已知
m=max(a,b,c)/max(a+b,b,c)*max(a,b,b+c)
将求三个数的最大数max(x,y,z)定义成函数和过程两种方法作此题。

1
var
i:longint;
s:string;
begin
readln(s);
for i:=3 downto 1 do
write(s[i]);
writeln;
end.
2
var
i,j:longint;
begin
for i:=1 to 5 do
begin
for j:=1 to i do
write('*');
writeln;
end;
end.
3
const
n=10;
var
a:array[1..n]of longint;
i,,temp,j:longint;
begin
for i:=1 to n do
read(a[i]);
for i:=1 to n-1 do
for j:=i+1 to n do
if a[j]>a[i] then
begin
temp:=a[i];
a[i]:=a[j];
a[j]:=temp;
end;
for i:=1 to n do
write(a[i],' ');
end.
4
函数
var
a,b,c:longint;
function max3(aa,bb,cc:longint):longint;
function max2(xx,yy:longint):longint;
begin
if xx>yy then
max2:=xx
else max2:=yy;
end;
begin
max3:=max