Recent Posts
printf("ho_tari\n");
procScore 본문
#include <stdio.h>
int main(void)
{
//int score1, score2, score3, score4, score5;
int scores[5];
//scanf("%d", &score1);
//scanf("%d", &score2);
//scanf("%d", &score3);
//scanf("%d", &score4);
//scanf("%d", &score5);
//scanf("%d", &score[0]);
//scanf("%d", &score[1]);
//scanf("%d", &score[2]);
//scanf("%d", &score[3]);
//scanf("%d", &score[4]);
for (int i = 0; i < 5; ++i)
{
scanf("%d", &scores[i]);
}
//int total = score1 + score2 + score3 + score4 + score5;
int total = 0;
for (int i = 0; i < 5; ++i)
{
total = total + scores[i];
}
double average;
average = (double)total / 5.0;
printf("total: %d\taverage: %.2f\n", total, average);
return 0;
}
<compile 결과>
'C' 카테고리의 다른 글
star (0) | 2023.09.01 |
---|---|
pyramid (0) | 2023.09.01 |
printOne2Ten (0) | 2023.09.01 |
printA2Z(가로) (0) | 2023.09.01 |
printA2Z(세로) (0) | 2023.09.01 |