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.

C Programming Interview Question
C Programming Interview Question

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)

Download C Programming Interview Questions And Answers PDF

Previous QuestionNext Question
How do I round numbers?My floating-point calculations are acting strangely and giving me different answers on different machines.