create an array of size 100×6to store points of 100 students in 6 subjects. Assign values with natural numbers starting from 100.Display the points secured in reverse order.
Answers
Answered by
1
Answer:
// A C++ program to print elements which are
// greater than avg of array
#include <iostream>
using namespace std;
// Print array elements greater than average
void printAboveAvg(int arr[], int n)
{
// Find average
double avg = 0;
for (int i = 0; i < n; i++)
avg += arr[i];
avg = avg / n;
// Print elements greater than average
for (int i = 0; i < n; i++)
if (arr[i] > avg)
cout << arr[i] << " ";
}
// Driver program
int main()
{
int arr[] = { 5, 4, 6, 9, 10 };
int a = sizeof(arr) / sizeof(arr[0]);
printAboveAvg(arr, a);
return 0;
Similar questions
English,
6 days ago
Computer Science,
6 days ago
Math,
6 days ago
Physics,
12 days ago
Hindi,
12 days ago
Math,
8 months ago
English,
8 months ago
Business Studies,
8 months ago