Viết chương trình nhập vào n số, in ra theo thứ tự ngược lại VD: Viết 1; 2; 3 -> In ra: 3; 2; 1

2 câu trả lời

Uses crt;

Var n, i: integer;

      X: ARRAY[1..100] OF integer;

begin

Write('Nhap so lg ptu, n = '); read(n);

For i:=1 to n do 

begin write('So thu X[',i,'] la: '); read(X[i])

end;

For i:=n downto 1 do write(X[i],',');

readln;

end.

Program TH;
Uses crt;
Var a,b: integer;
c: array[1..100] of integer;
Begin
Clrscr;
Write('Nhap so luong so: '); readln(a);
For b:= 1 to a do
Begin
Write('Nhap so thu ', b,': '); readln(c[b]);
end;
For b:=a downto 1 do write(c[b] , ',');
Readln;
End.

Câu hỏi trong lớp Xem thêm