Advertisement
Guest User

Untitled

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