Question 2:
(1 mark, file to be edited: Q2.c)
The program allows the user to input an array of integers consisting of 'n' elements from the keyboard.Print to the screen the average of the values of the odd numbers, with three decimal places.
Here is an example of how the program will run:
Enter: n = 6, elements: 9, 7, 12, 8, 6, 15
6
9 7 12 8 6 15
OUTPUT:
10.333
Press any key to continue
Question 3:
(1 mark, file to be edited: Q3.c)
The program allows the user to enter an array of integers consisting of 'n' elements from the keyboard.
Find and print to the screen the elements that are prime numbers. If not found, print: "No prime number exists".
Here is an example of how the program will run:
n = 6; array = [1, -2, 3, 9, 6, 7]
n = 5; array = [4, 8, -3, 6, 10]
Zoom
+ 93%
Close