학생 점수의 총합을 구하는 프로그램

나무에물주기·2022년 10월 21일
0

Coding Test

목록 보기
68/77
#include <iostream>
using namespace std;

// 학생 점수의 총 합 

int main(void)
{

    int score[5][2];
    int total[2] = {0, };
    int i;
    for(i = 0; i < 5; i++)
    {
        cout << i + 1 << "번 학생의 수학, 영어 점수 : ";
        cin >> score[i][0] >> score[i][1];
    }

    for(i = 0; i < 5; i++)
    {
        total[0] += score[i][0];
        total[1] += score[i][1];
    }

    cout << "\n\n5명의 수학 점수 합계 : " << total[0] << endl;
    cout << "5명의 영어 점수 합계 : " << total[1] << endl;

    return 0;
}
profile
개인 공부를 정리함니다

0개의 댓글