Advertisement
Guest User

Untitled

a guest
Apr 25th, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. #include <stdio.h>
  2. float hesap (float);
  3. int main ()
  4. { float p;
  5. float avg =hesap(p);
  6.  
  7. printf ("%f is avg",avg);
  8.  
  9.  
  10. return 0;
  11. }
  12.  
  13.  
  14. float hesap(float p)
  15. {
  16. float sum =0, c=0;
  17. int x;
  18. do{
  19. printf ("enter a value");
  20. scanf ("%d",&x);
  21.  
  22. if (x>0)
  23. {sum+=x;
  24. c++;
  25. }
  26. p=sum/c;
  27. }
  28. while (x!=0);
  29.  
  30. return p;
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement