Lab Test 1 Make-up (Blue Test)

 

加選同學五題全做,上次考試不到30分同學任選三題作答。

 

1.1.        Read in 20 integers into an array, find the largest element and print it out.

1.2.        Read in 20 integers into an array, find the largest element and swap it with the last element in the array. Then swap the largest element in the remaining 19 elements with the second to the last element in the array. Repeat this in a loop to sort the entire array. Print out the array after each swapping.

1.3.        Write a program to print out the following 9 x 9 pattern:

 

 

 

 

 

 

 

 

 

 

 

*

 

 

 

 

 

 

 

*

 

 

*

 

 

 

 

 

*

 

 

 

 

*

 

 

 

*

 

 

 

 

 

 

*

 

*

 

 

 

 

 

 

 

 

*

 

 

 

 

 

 

 

 

*

 

*

 

 

 

 

 

 

*

 

 

 

*

 

 

 

 

*

 

 

 

 

 

*

 

 

*

 

 

 

 

 

 

 

*

 

 

 

 

 

 

 

 

 

 

1.4.        Write a program to print out the following 9 x 9 pattern:

 

 

 

 

 

 

 

 

 

 

 

*

*

*

*

*

 

 

 

 

 

 

*

*

*

*

*

 

 

 

 

 

 

*

*

*

*

*

 

 

 

 

 

 

*

*

*

*

*

 

 

 

 

 

 

*

*

*

*

*

 

 

 

 

*

*

*

*

*

 

 

 

 

*

*

*

*

*

 

 

 

 

*

*

*

*

*

 

 

 

 

*

*

*

*

*

 

 

 

 

 

 

 

 

 

 

 

 

 

 

1.5.        Write a program to print out the following 9 x 9 pattern:

 

 

 

 

 

 

 

 

 

 

 

*

*

*

*

*

 

 

 

 

 

 

*

 

 

 

*

 

 

 

 

 

 

*

 

 

 

*

 

 

 

 

 

 

*

 

 

 

*

 

 

 

 

 

 

*

 

 

 

*

 

 

 

 

*

 

 

 

*

 

 

 

 

*

 

 

 

*

 

 

 

 

*

 

 

 

*

 

 

 

 

*

*

*

*

*