班级成绩输入输出

http://www.nowcoder.com/questionTerminal/60d96b08e1cb42e38629d54e37eac008

#include<bits/stdc++.h>
using namespace std;

double a[45][45] = {};
double s[45] = {};

int main()
{
    for(int i = 1; i <= 5; i++)
    {
        for(int j = 1; j <= 5; j++)
        {
            cin >> a[i][j];
            s[i] += a[i][j];
        }
    }
    for(int i = 1; i <= 5; i++)
    {
        for(int j = 1; j <= 5; j++)
        {
            cout << fixed << setprecision(1) << a[i][j] << " "; 
        }
        cout << s[i] << endl; 
    }
    return 0;
}
全部评论

相关推荐

评论
1
1
分享
牛客网
牛客企业服务