printf("%d",pow(5,3))
it's printing 0, and works fine when number is different from 5 why?
Can anyone explain this ?
printf("%d",pow(5,3))
it's printing 0, and works fine when number is different from 5 why?
Can anyone explain this ?
The return type of the power function is double. using the double conversion specifier to prints the output of power function.
the conversion specifier for double is not "%d". It should be "%f".
It should be:
printf("%f",pow(5,3));
Since return type of pow
is double
You have to use %lf or %f:
printf("%lf",pow(5,3));
As pow function returns double.