You are on page 1of 1

Lab 07, 16/12/2021

Arrays (cont)

1. Create a single dimensional array (user input the number of elements from
the keyboard, the number of elements can not exceed 10).
Divide the array into 2 equal halves. Sort the 1st half by ascending order and
the 2nd half by descending order

Example:
n = 7; { 1 5 7 6 2 8 2 }  sorted array will look like this { 1 5 7 6 8 2 2 }
(the 6 is kept unchanged)
n = 6; { 1 5 7 2 8 2}  sorted array will look like this {1 5 7 8 2 2}

2. Develop a program to input an integer N then create a two dimensional array


which follows the rule as in the example (N=5)

 1 3 8 15 24 
 2 1 8 15 24 
 
A   3 3 11 15 24 
 
 4 4 4 11 24 
 5 5 5 5 29 

You might also like