Viết chương trình nhập A gồm N phần tử xuất mảng giảm dần

Viết chương trình nhập A gồm N phần tử xuất mảng giảm dần

Viết Chương Trình nhập vào một dãy số nguyên có n phần tử. Sắp xếp theo thứ tự tăng dần và in kết quả ra màn hình.

program ct;

ues crt;

var A:array [1..1000] of integer;

      i,j,n,tg:integer;

begin clrscr;

   write('Nhap so phan tu n: '); readln(n);

   for i:=1 to n do

     begin

        writeln('Nhap so thu ',i,': '); readln(A[i]);

     end;

   for i:=1 to n-1 do

   for j:=i+1 to n do

     if A[i]>A[j] then

        begin

           tg:=A[i];

           A[i]:=A[j];

           A[j]:=tg;

        end;

   writeln('Day so sap xep theo thu tu tang dan la: ');

   for i:=1 to n do

     write(A[i]:3);

readln;

end.
Bạn thấy bài viết này như thế nào?: 
Average: 8.8 (4 votes)
Ảnh của Tommy Tran

Tommy owner Express Magazine

Drupal Developer having 9+ year experience, implementation and having strong knowledge of technical specifications, workflow development. Ability to perform effectively and efficiently in team and individually. Always enthusiastic and interseted to study new technologies

  • Skype ID: tthanhthuy

Bình luận (0)

 

Add Comment

Filtered HTML

  • Các địa chỉ web và email sẽ tự động được chuyển sang dạng liên kết.
  • Các thẻ HTML được chấp nhận: <a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Tự động ngắt dòng và đoạn văn.

Plain text

  • No HTML tags allowed.
  • Các địa chỉ web và email sẽ tự động được chuyển sang dạng liên kết.
  • Tự động ngắt dòng và đoạn văn.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.

Advertisement

 

jobsora

Dich vu khu trung tphcm

Dich vu diet chuot tphcm

Dich vu diet con trung

Quảng Cáo Bài Viết

 
The investment case for employing a Drupal core contributor

Một số cách để đầu tư, đóng góp cho Drupal 8 core

I asked my team at Acquia to start tracking the impact of the Drupal core contributors on sales. Below, I'll share some data of how Acquia tracked this and why I'm bullish on there being a business case.

Barracuda Master Installer

Barracuda is a bash script to install and/or upgrade, tuned for high performance, Aegir Master Instance with all related system services. Barracuda is compatible with Octopus installer.

Facebook lại thay đổi thuật toán, các fanpage cần chú ý ngay

Facebook lại thay đổi thuật toán, các fanpage cần chú ý ngay

Facebook vừa mới cho biết họ sẽ mang những mẫu tin chất lượng hơn đến với bảng tin News Feed 

Công ty diệt chuột T&C

 

Diet con trung