Professional Documents
Culture Documents
PRACTICAL WORK 1 2 3 4 5 6
TITLE Arrays
/4 [Task A]
Successfully /4 [Task B]
Task is halfway Cannot complete
Successfully completed completed all task A great extent of help
Autonomy completed with task and /4 [Task C]
all task independently with minimal is needed
moderate supervision procedures /4 [Task D]
supervision
/4 [Task E]
TOTAL /80
DEC20012 – PROGRAMMING FUNDAMENTALS / PRACTICAL WORK RUBRIC
CLO 2P
Direction: Complete the practical works. Consult with your lecturer for any
problem encountered.
OBJECTIVES :
EQUIPMENTS :
Procedures:
6.1.1 Write the following programming below and try to comprehend it. Save it as
Practical61.
PSIS
2
/ JKE / DEC20012 – PROGRAMMING FUNDAMENTALS / PRACTICAL WORK 6
CLO 2P
Procedures:
#include <stdio.h>
int main ()
{ int n[ 10 ]; /* n is an array of 10 integers */
int i,j; /* initialize elements of array n to 0
*/
4
/ JKE / DEC20012 – PROGRAMMING FUNDAMENTALS / PRACTICAL WORK 6
CLO 2P
PSIS
Procedures:
6.1.4 The simplest form of a multidimensional array is the two dimensional array.
Write the following programming codes below and save it as Practical63.
6.1.5 Observe how two dimensional arrays is being initialized and accessed.
6
/ JKE / DEC20012 – PROGRAMMING FUNDAMENTALS / PRACTICAL WORK 6
CLO 2P
8
/ JKE / DEC20012 – PROGRAMMING FUNDAMENTALS / PRACTICAL WORK 6
CLO 2P
6.1.6 Carefully write the following programming codes and try to comprehend.
Save it as Practical64.
9
PSIS / JKE / DEC20012 – PROGRAMMING FUNDAMENTALS / PRACTICAL WORK 6
CLO 2P
10
PSIS / JKE / DEC20012 – PROGRAMMING FUNDAMENTALS / PRACTICAL WORK 6
CLO 2P
11
PSIS / JKE / DEC20012 – PROGRAMMING FUNDAMENTALS / PRACTICAL WORK 6
CLO 2P
Task A
Write a program that is able to read and display value from the following
array element by referring to its index number.
house
Answer:
12
PSIS / JKE / DEC20012 – PROGRAMMING FUNDAMENTALS / PRACTICAL WORK 6
CLO 2P
Task
Write a program
that ask the user for daily rainfall reading for a period of one
week and assign it into an array named rain[]. The program must be able to
access the array element and display it onto the screen while at the same
time calculating the summation of the daily rainfall by using for loop. The
program then display the summation.
Answer:
13
PSIS / JKE / DEC20012 – PROGRAMMING FUNDAMENTALS / PRACTICAL WORK 6
CLO 2P
Task
Write a program
TASKC
Answer:
14
PSIS / JKE / DEC20012 – PROGRAMMING FUNDAMENTALS / PRACTICAL WORK 6
CLO 2P
Task
Write a program
D
that reads 10 integer numbers from the user and store it in an array.
The program must be able to determine and print only even numbers and the
total of the even numbers to the screen. The program format is as follows:
Number 1: xx
Number 2: yy
…
Number 10: zz
Answer:
15
PSIS / JKE / DEC20012 – PROGRAMMING FUNDAMENTALS / PRACTICAL WORK 6
CLO 2P
Task
Write a program
E
grades[0] 80 70 65 89 90
grades[1] 85 80 80 82 87
16
PSIS / JKE / DEC20012 – PROGRAMMING FUNDAMENTALS / PRACTICAL WORK 6
CLO 2P
#include<stdio.h>
int main()
{
float marks[3] = {90.5,92.5,96.5};
int a=0;
while(a<3)
{
printf(“%.2f”, marks[a]);
a++;
}
}
17
PSIS / JKE / DEC20012 – PROGRAMMING FUNDAMENTALS / PRACTICAL WORK 6
CLO 2P
a) 90.5 92.5 96.5
b) 90.50 92.50 96.50
c) 90 92 96
d) Compile error
a) 5
b) 6
PSIS / JKE / DEC20012 – PROGRAMMING FUNDAMENTALS / PRACTICAL WORK 6
CLO 2P
c) 0
d) None of these
10
#include<stdio.h>
void main()
{
int size, i;
scanf(“%d”, &size);
int arr[size];
for(i=1; i<=size; i++)
{
scanf(“%d”, arr[i]);
printf("%d",arr[i]);
}
11