zoi20

Untitled

Jan 4th, 2014
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.44 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. float srednja(float* x)
  5. {
  6.     int i;
  7.     float suma=0,ostatak,prosjek;
  8.     for(i=0;i<5;i++)
  9.     {
  10.         ostatak=x[i]-(int)x[i];
  11.         suma+=ostatak;
  12.     }
  13.     prosjek=suma/5;
  14.     return prosjek;
  15. }
  16.  
  17. int main()
  18. {
  19.     int i;
  20.     float a[5];
  21.     for(i=0;i<5;i++)
  22.     {
  23.       printf("unesi %d. broj ",i+1);
  24.       scanf("%f",a[i]);
  25.  
  26.     }
  27.  
  28.     printf("%f",srednja(a));
  29.     return 0;
  30. }
Advertisement
Add Comment
Please, Sign In to add comment