By the way, this isn't standard C, you aren't declaring your variable at the good place (you are doing like those silly C++ programmers who are declaring variables everywhere ). C let you only declare variables after an '{' or after another variable declaration (in the case it's not global variable).
That said... you could change this
Code:
mean = (double) num1 + (double) num2 + (double) num3;
mean /= 3.0;
for this
Code:
mean = (double) (num1 + num2 + num3);
mean = mean / 3.0;
or, simple, this
Code:
mean = (num1 + num2 + num3) / 3.0;
or
Code:
mean = (double) (num1 + num2 + num3) / 3;
Anyway, just to point out that there is "better" way to use cast than others.