Viết chương trình nhập A gồm N phần tử chèn thêm x vào vị trí đầu tiên

Viết chương trình nhập A gồm N phần tử chèn thêm x vào vị trí đầu tiên

Viết chương trình nhập A gồm N phần tử chèn thêm x vào vị trí đầu tiên

Program Chen;

Uses crt;

Var i,spt, so,vitri: Integer;

A: Array[1..100] Of Integer;

Begin

    Clrscr;

    Writeln(' + CHEN MOT SO VAO MANG +');

    Writeln('-------------------------------');

    Write('-Co bao nhieu phan tu-: ');

    Readln(spt);

    For i:=1 To spt Do

      Begin

        Write('-Phan tu A[',i,']= '); Readln(a[i]);

      End;

    Writeln; Writeln('--MANG TRUOC KHI CHEN--');

    For i:=1 To spt Do Write(a[i]: 6); Writeln;

    Write('-Can che so: ');

    Readln(so); Write('-Vao vi tri 1: ');

    vitri:= 1;

    For i:=spt+1 Downto Vitri+1 Do    Writeln;

    a[i]:=a[i-1]; a[vitri]:=so; spt:=spt+ 1;

    Writeln('MANG SAU KHI CHEN');

    Readln;

    For i:=1 To spt Do Write(a[i]: 6);

End.
Bạn thấy bài viết này như thế nào?: 
Average: 1 (2 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

 
Hướng dẫn Syncing Databases giữa Drupal Websites với Backup and Migrate

Hướng dẫn Syncing Databases giữa Drupal Websites với Backup and Migrate

John Hannah explains how you can use destinations in Backup and Migrate module to sync Drupal databased.

5 triệu đơn đặt hàng “sát thủ giá rẻ” Kindle Fire

5 triệu đơn đặt hàng “sát thủ giá rẻ” Kindle Fire

Theo một báo cáo trên nhật báo chuyên về công nghệ Digitimes, chỉ vài ngày trước khi ra mắt Kindle Fire, Amazon tuyên bố số lượng các đơn đặt hàng cho chiếc máy tính bảng đã lên đến hơn 5 triệu.

[Phần 1]High performance in Drupal: Give your site a boost

[Phần 1]High performance in Drupal: Give your site a boost

Drupal is a highly flexible CMS with great community support in the form of drop in add-ons (contrib modules).

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

 

Diet con trung