Uploaded by
ahuyahihi4
0% found this document useful [0 votes]
0 views
1 page
Copyright
© © All Rights Reserved
Share this document
Did you find this document useful?
Is this content inappropriate?
0% found this document useful [0 votes]
0 views1 page
BÀI TẬP MẢNG 2 CHIỀU
Uploaded by
ahuyahihi4
Jump to Page
You are on page 1of 1
Search inside document
Reward Your Curiosity
Everything you want to read.
Anytime. Anywhere. Any device.
No Commitment. Cancel anytime.
- What is Scribd?
- Documents[selected]
- Explore Documents
Categories
- Academic Papers
- Business Templates
- Court Filings
- All documents
- Sports & Recreation
- Bodybuilding & Weight Training
- Boxing
- Martial Arts
- Religion & Spirituality
- Christianity
- Judaism
- New Age & Spirituality
- Buddhism
- Islam
- Art
- Music
- Performing Arts
- Wellness
- Body, Mind, & Spirit
- Weight Loss
- Self-Improvement
- Technology & Engineering
- Politics
- Political Science All categories
100% found this document useful [4 votes]
7K views
12 pages
Copyright
© Attribution Non-Commercial [BY-NC]
Available Formats
DOC, PDF, TXT or read online from Scribd
Share this document
Did you find this document useful?
100% found this document useful [4 votes]
7K views12 pages
Tìm phần tử nhỏ nhất và lớn nhất của mảng 2 chiều
Jump to Page
You are on page 1of 12
Ví dụ 1
.
Tìm phần tử nhỏ nhất và lớn nhất của mảng 2 chiều và đổi chỗ chúng chonhau
: procedure exchange;var i,j,i1,j1,i2,j2,tg : integer; begini1 := 1; j1 := 1; {i1,j1 là vị trí phần tửmin}i2 := 1; j2 := 1; {i2,j2 là vị trí phần tửmax}for i := 1 to m dofor j := 1 to n do beginif a[i1,j1] > a[i,j] then begin {so sánh tìm min}i1 := i; j1 := j;{ghi nhận vị trí min mới}end;if a[i2,j2] < a[i,j] then begin {so sánh tìm max}i2 := i; j2 := j;{ghi nhận vị trí max mới}end;end;tg := a[i1,j1]; a[i1,j1] := a[i2,j2];a[i2,j2] := tg; {đổi chỗ}end;Tìm max cũng tương tự, chỉ thay dấu so sánh. procedure timmax;var i, k : integer; begink := 1;for i := 2 to n doif a[k] < a[i] then k := i;writeln['Phan tu lon nhat laa[',k,']=',a[k]];end;
BÀI TẬP 2Tìm phần tử nhỏ nhất, lớn nhất của một mảng [cần chỉ ra cả vị trí của phần tử].
procedure timmin;var i, k : integer; begink := 1;for i := 2 to n doif a[k] > a[i] then k := i;writeln['Phan tu nho nhat laa[',k,']=',a[k]];end; procedure timmax;var i, k : integer; begink := 1;for i := 2 to n doif a[k] < a[i] then k := i;writeln['Phan tu lon nhat laa[',k,']=',a[k]];end;
BÀI TẬP 1Nhập vào một số n [5