Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(void)
- {
- int score[5];
- int i;
- int tot =0;
- double avg;
- int cnt;
- cnt = sizeof(score) / sizeof(score[0]);
- for(i = 0; i < cnt; i++)
- {
- scanf("%d", &score[i]);
- }
- for(i = 0; i < cnt; i++)
- {
- tot += score[i];
- }
- avg = tot / (double)cnt;
- for(i = 0; i < cnt; i++)
- {
- printf("%5d",score[i]);
- }
- printf("\n");
- printf("평균 : %.1lf\n", avg);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement