#include <stdio.h> int main() { int mathscore[11] = {0,},i; //mathscore[10] = 총합 for(i = 0;i < 10;i++) { printf("%d/10 \n",i+1); printf("수학점수를 입력해 주세요. : "); scanf("%d",&mathscore[i]); mathscore[10] = mathscore[10] + mathscore[i]; } printf("총합 : %d, 평균 : %d \n",mathscore[10],mathscore[10] / 10 ); return 0; }
#include <stdio.h> int main() { int mat[11]={0,} , i=0; while(i<10) { printf("수학점수입력 %d번째 : ",i+1); scanf("%d",&mat[i]); mat[10]=mat[10]+mat[i]; i++; } printf("총합=%d 평균=%d",mat[10],mat[10]/10); return 0;