Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #pragma warning(disable:4996)
- #define MAX_STUDENT 5
- struct student {
- char name[20];
- int korean, english, math;
- double average;
- };
- int main(void)
- {
- struct student stdc[MAX_STUDENT];
- double total_average = 0;
- int i = 0;
- printf("%d명의 학생 정보를 입력하세요.\n", MAX_STUDENT);
- for (i = 0; i < MAX_STUDENT; i++);
- {
- printf("이름 : ");
- gets(stdc[i].name);
- printf("국어, 영어, 수학 점수 : ");
- scanf("%d %d %d", &stdc[i].korean, &stdc[i].english, &stdc[i].math);
- stdc[i].average = (double)(stdc[i].korean + stdc[i].english + stdc[i].math) / 3;
- total_average += stdc[i].average;
- }
- total_average /= MAX_STUDENT;
- printf("\n이름 국어 영어 수학 평균\n");
- for (i = 0; i<MAX_STUDENT; i++)
- {
- printf("%-10s %3d %3d &3d %6.2f\n", stdc[i].name, stdc[i].korean, stdc[i].english, stdc[i].math, stdc[i].average);
- }
- printf("전체 평균 : %6.2f", total_average);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment