CSE215 Lab Manual Lab 4 Array
CSE215 Lab Manual Lab 4 Array
Lab – 4: Array
Objective:
● To learn about array
● To learn to use array to solve different problems
Task:
1. Declare an integer array of size 6, initialize it with user input, calculate and print the average.
Now calculate the percentage of numbers that are above that average.
For example: if 3 of the array elements are greater than average, percentage is: 3 * 100 / 6 = 50%
2. Take an integer from user, generate that many fibonacci numbers and store in an array.
Display the array.
Sample output:
Enter a number: 8
First 8 Fibonacci numbers: 0 1 1 2 3 5 8 13
4. Take an integer array and print only the numbers that are in consecutive orders of 3.
Enter size: 12
Enter numbers: 1 2 3 2 2 2 11 4 4 4 3 3
Output: 2 4