Basic and Advance C Question:
Download Job Interview Questions and Answers PDF
I am sure I have got the trig functions declared correctly, but they are still giving me wrong answers.
Answer:
You weren't handing them angles in degrees, were you? C's trig functions (like FORTRAN's and most other languages) accept angles in radians. The conversion from degrees to radians is simple enough:
sin(degrees * pi / 180)
sin(degrees * pi / 180)
Download C Programming Interview Questions And Answers
PDF
Previous Question | Next Question |
How do I round numbers? | My floating-point calculations are acting strangely and giving me different answers on different machines. |