You are on page 1of 2

CSC128: INTRODUCTION TO COMPUTER PROBLEM SOLVING

PROGRAMMING EXERCISE 13

1. Write a complete program based on the instructions below:


(a) Declare an array called myArray to store TEN (10) integer numbers
(b) Initialize myArray based on the following table:
Index Value
0 10
1 15
2 20
3 25
4 30
5 45
6 55
7 65
8 75
9 100
(c) Display the first element stored in the array
(d) Display the fourth element stored in the array
(e) Display the last element in the array
(f) Display all the elements stored in myArray

2. Complete the program based on the given comments:


#include<iostream.h>

void main()
{
//declare an array to store 5 letters

//ask the user to enter 5 letters & store them in the array

//display all the letters entered by the user


}

3. Based on the following statement:


int myArray[10] = {89, 75, 99, 100, 56, 65, 88, 97, 64, 67};

Write a complete program to:


(a) Calculate the sum
(b) Compute the average
(c) Find the smallest number
(d) Find the largest number
(e) Display all the results

PREPARED BY: NYCJ@FSKM, UiTMTKD


CSC128: INTRODUCTION TO COMPUTER PROBLEM SOLVING
PROGRAMMING EXERCISE 13

4. Write a program to find the smallest and the largest number among EIGHT (8) numbers
which are entered by the user. Display the result with the index of the array.

PREPARED BY: NYCJ@FSKM, UiTMTKD

You might also like