Advertisement
MUstar

IoT C언어 0522 - 8-3

May 22nd, 2017
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.30 KB | None | 0 0
  1. #include <stdio.h>
  2.  
  3. int main(void)
  4. {
  5.     int score[5];
  6.     int i;
  7.     int tot = 0;
  8.     double avg;
  9.  
  10.     for(i=0;i<5;i++){scanf("%d",&score[i]);}
  11.     for(i=0;i<5;i++){tot+=score[i];}
  12.     avg = tot / 5.0;
  13.     for(i=0;i<5;i++){printf("%5d",score[i]);}
  14.     printf("\n");
  15.  
  16.     printf("평균 : %.1f\n",avg);
  17.  
  18.     return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement