ÇÑ ÇлýÀÇ 4°ú¸ñÀÇ Æò±ÕÀ» ³»¾î ¸®ÅÏÇÏ´Â ¿¹
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | #define _CRT_SECURE_NO_WARNINGS #include <stdio.h> #define NUM_SUBJECTS 4 double avg_score(int jumsu[], int num) { int i, sum = 0; for (i = 0; i < num; i++) { sum += jumsu[i]; } return (double)sum / num; } int main(void) { int i, scores[NUM_SUBJECTS] ={98, 50, 33, 60}; double average; average = avg_score(scores, NUM_SUBJECTS); printf("ÇлýÀÇ 4°ú¸ñÀÇ Æò±ÕÀº %lf ÀÔ´Ï´Ù.\n", average); } | cs |