Documente Academic
Documente Profesional
Documente Cultură
Lab Task 1
Write a program to input numbers in the array and calculate the average of
all the numbers entered by the user.
Lab Task 2
Write a program to input 15 integers in the array. Now display amount of
even and amount of odd numbers in the array
Lab Task 3
Write a program to allow the user to store the temperature of the months of
the year. Calculate the average temperature for the entire year and
compare it to the average temperature of the previous year which is
entered by the user. If the average temperature is greater than the previous
year then display “Global warming is present” otherwise display “no global
warming”.
Expected Output
Lab Task 4
Write a program to enter the marks of midterm of a class of 15 students.
Find out the average marks obtained by the entire class. Display the
amount of students whose midterm marks were equal or greater than the
average of the class and the amount of students who obtained less than
average of class.
Expected Output
Lab Task 5
(Linear Search)
15 numbers are entered into an array. The number to be searched is
entered through the by another user. Write a program to find if the number
to be searched is present in the array and if it is present, display the
indexes at which the number is present and the number of times it appears
in the array.
Expected Output
Array = 12, 14, 8,6, 21, 27, 12, 3, 9, 12, 8, 17, 12, 14, 11
Number to be searched:14
14 is present at index: 1
14 is present at index: 13
It is present 2 times in array
Number to be searched:7
Not present in array
Number to be searched:12
12 is present at index: 0
12 is present at index: 6
12 is present at index: 9
12 is present at index: 12
It is present 4 times in array