code/C

[C]성적관리프로그램 - 한 사람

shallot 2017. 4. 20. 13:10

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#include<stdio.h>
void main()
{
    char name[10];/////////////한 사람 성적 구하기
    int score[4];//국,영,수,총
    float avg;//평균
 
    printf("Name input: ");
    scanf("%s",name);
 
    printf("Kor Score input: ");
    scanf("%d",score);
    printf("Eng Score input: ");
    scanf("%d",score+1);
    printf("Mat Score input: ");
    scanf("%d",score+2);
 
    
    *(score+3)=*score+*(score+1)+*(score+2);
 
    avg=*(score+3)/3.f;
    
    printf("%s\t%d\t%d\t%d\t%d,\t%f\n",name,*score,*(score+1),*(score+2),*(score+3),avg);
    
 
}