Return int to double?

Im getting a warning from DEVC++. It is saying "Warning-converting to "int" from "double""

All i want my function to do it return a double instead of an int.

1
2
3
4
5
6
7
8
9
10
11
//find avg
int findavg(int x,int y,int z){
    
    int sum;
    double avg;
    
    sum=x+y+z;
    avg=sum/(double)3;
    
    return avg;
}


How can I get rid of this? Thank you.
Change line 2 so that the return type (the int to the left of the findavg) is a double.

Happy programming!

-Albatross
Thank You!!
Topic archived. No new replies allowed.