Respuesta :
Answer:
#include <iostream>
using namespace std;
int main()
{
float arr[10];
float sum=0.0;
for(int i=0;i<10;i++){
cout<<"enter the 10 student record (0-100): ";
cin>>arr[i];
}
float min=arr[0];
float max=arr[0];
for(int i=0;i<10;i++){
if(arr[i]<min){
min=arr[i];
}
if(arr[i]>max){
max=arr[i];
}
sum = sum+arr[i];
}
float avg = sum/10;
cout<<"Smallest score: "<<min<<endl;
cout<<"Largest score: "<<max<<endl;
cout<<"Average score: "<<avg<<endl;
return 0;
}
Explanation:
Create the main function in the c++ programming and declare the variables.
Then, use the for loop to enter the scores 10 times in the array.
another for loop is used to traversing the array and check for smallest and largest and also calculate the sum of all element in the array.
for check smallest, define the temporary variable min with first element of array.
then, if statement check each element with the min and update the min if condition true.
similarly for largest.
after that, take the average by dividing the sum with total number of element in array.
finally print the output.