Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int myFunc(float);
- int main (void){
- float p;
- float avg = myFunc(p);
- printf("the avg is : %d", avg);
- return 0;
- }
- int myFunc(float p){
- int sum = 0, i, x;
- printf("enter numbers: ");
- for(i = 0;x != 0;i++){
- scanf("%d", &x);
- if (x > 0){
- sum += x;
- p = sum / i;
- }
- }
- return p;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement