I am trying to take some square roots
C Interview Questions and Answers
(Continued from previous question...)
I am trying to take some square roots
Q: I'm trying to take some square roots, and I've simplified the code down to
main()
{
printf("%f\n", sqrt(144.));
}
but I'm still getting crazy numbers.
A: Make sure that you have #included <math.h>, and correctly declared other functions returning double. (Another library function to be careful with is atof, which is declared in <stdlib.h>.)
(Continued on next question...)
Other Interview Questions
|