Lab Exercise 6
Lab Exercise 6
CCS003L
(COMPUTER PROGRAMMING 1)
EXERCISE
6
ARRAYS
I. <
II.
III.
score
An array is a sequential collection of data storage locations, each of which holds the same
type of data. Each storage location is called an element of the array.
You declare an array by writing the type, followed by the array name and the subscript.
The subscript is the number of elements in the array, surrounded by square brackets. For
example:
long LongArray[25];
declares an array of 25 long integers, named LongArray.
V. LABORATORY ACTIVITY
Write a program that will ask the user to enter the size of the array n < 100. Once the
array size is validated, it is required that the user will enter the elements of the array.
Finally, display the sorted array elements using any sorting algorithm.
Sample run:
Enter the size of the array: 4
Array element 1: 6
Array element 2: 4
Array element 3: 5
Array element 4: 2
The sorted array is: 2 4 5 6
Create a program that will accept two integer numbers. These integer numbers will be the
limit of the multiplication table. Store the values in a two-dimensional array.
Sample output:
Enter x: 2
Enter y: 3
1 2 3
2 4 6
VI. QUESTION AND ANSWER
1. Why is it necessary, being a programmer, to use arrays?. What are the risks of not
using arrays?
V. ASSESSMENT
Note: The following rubrics/metrics will be used to grade students’ output in the lab
Exercise 6.
Topic ARRAYS
Lab Activity No 6.2
Lab Activity Multiplication table
CLO 2, 3
Program execution (20)
Correct output (20)
Design of output (10)
Design of logic (20)
Standards (20)
Delivery (10)
TOTAL