a Write a program in C that reads 10 integers from the user
a. Write a program in C++ that reads 10 integers from the user and stores them in an array, Calculate the average of these 10 numbers and print the numbers in the array that are greater than or equal to the average.
b. Write a program in C++ that reads 10 integers from the user and stores them in a vector, Calculate the average of these 10 numbers and print the numbers in the vector that are less than or equal to the average.
c. Write a program in C++ that asks the user to enter an array of size 10 and pass the array to a function named reverse_array that takes as its arguments an array of floating point values and an integer that tells how many floating point values are in the array. The function must reverse the order of the values in the array. The function should not return any value. Do not forget to write the main function as well. Display the original array and the reversed array in the main function.
d. Write a program in C++ that stores the following elements in a two dimensional array and prints out the product of all the diagonal elements of the array. Use Nested For Loops to traverse the array to calculate the product. The elements of the array are as follows :
12 22 34 45
33 1 2 5
4 98 21 13
3 21 45 11
You should display the product of the following elements: 12 x 1 x 21 x 11x 3 x 98 x 2 x 45
Solution
a)
#include<iostreamh>
 #include<stdio.h>
void main()
 {
 int n,i;
 int arr[10];
 int sum=0, average;
 cout<<\"Please enter 10 values\";
 for(i=0;i<10;i++)
 {
 cin>>n;
 arr[i]=n;
 }
for(i=0;i<10;i++)
 {
 sum= sum+arr[i];
 }
average = sum/10;
for(i=0;i<10;i++)
 {
 if(arr[i]>= average)
 {
 cout<<\"The element greater/equal to average of the numbers is\"<<arr[i]<<endl;
 }
 }
}

