1176 Problem Y "C Programming Language" Jiang Po Kushiro Editor - Exercises 7-1 grade point average

Problem Description

Input from the keyboard 10 student achievement, averaging scores higher than average scores and results

Entry

** 10 ** integer

Export

** the first line, the average score, Reserved 1 decimal.
The second line, above the average score, after each performance spaces. **

Sample input

60 60 60 70 70 70 80 80 80 70

Sample Output

70.0
80 80 80 

AC Code

#include <iostream>

using namespace std;


int main()
{
    int m[10];
    float ave;
    int sum = 0;
    for(int i = 0; i < 10; i++)
    {
        cin >> m[i];
        sum += m[i];
    }
    ave = sum / 10.0;
    printf("%.1f\n",ave);
    for(int j = 0; j < 10; j++)
    {
        if(ave < m[j])
       {
           cout << m[j] << " ";
       }
    }
    return 0;
}



Published 119 original articles · won praise 28 · views 40000 +

Guess you like

Origin blog.csdn.net/weixin_41179709/article/details/103973238