Write a program in C which take ten marks of students from t
Write a program in C++ which take ten marks of students from the user in an Array, find the average marks if the class and also find the number of students having greater score then average score of class.
Solution
#include <iostream>
using namespace std;
int main()
{
int n, i, arr1[n], arr2[n];
float num[100], sum=0.0, average, count=0;
cout << \"Enter the numbers of data: \";
cin >> n;
while (n > 100 || n <= 0)
{
cout << \"Error! number should in range of (1 to 100).\" << endl;
cout << \"Enter the number again: \";
cin >> n;
}
for(i = 0; i < n; ++i)
{
cout << i + 1 << \". Enter number: \";
arr1[i]=num[i];
cin >> num[i];
sum += num[i];
}
average = sum / n;
cout << \"Average = \" << average;
return 0;
for(i=0;i<n;++i)
{
if(arr[i]>average)
{
arr2[i]=arr[i];
count+=1
}
}
for(i = 0,i < count,i++)
{
cout << \"The Max are: \" << arr2[i]
}
}
