MUstar

IoT C언어 0626 - No.2

Jun 26th, 2017
64
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2.  
  3. int main(void)
  4. {
  5.     double ary[5] = {1.2,3.5,7.4,0.5,10.0};
  6.     double *pa = ary;
  7.     double *pb = ary +2; //??
  8.     double avg=0;
  9.     printf("배열 요소의 값 : ");
  10.     for(int i=0;i<5;i++)
  11.     {
  12.         avg+=pa[i];
  13.         printf("%.1f ", pa[i]);
  14.     }
  15.     printf("\n평균 : %.2f\n",avg/5);
  16.    
  17.     return 0;
  18. }
RAW Paste Data