To return a double value
Hi everyone! When I take the help of pointers,by keeping the return type of the function as void,the program works fine,but when I try to pass the values to the function and use return type as double.It only displays the interger part,even after typecasting.
double cal_per(int a,int b,int c)
It is giving the correct result. 55+66+77/3=66.
Actually the answer was varying from 0.000 to the right answer. So I thought there would be some problem with returning the double value.
The program is fine.
does exactly the same, is easier to read, and more likely to help you debug things when you *don't* initialise them properly?
double res = (a+b+c)/300.0;
Oh, and INDENT!
The answer can't vary. C does not use fuzzy logic. You wont get
Originally Posted by shruthi
"2+2 is 5 for large values of 2 and small values of 5"
If it varied, your program had errors. As it stands right now, the program will return 66.0