A few maths related C programming q's

Joined
5 Aug 2006
Posts
11,419
Location
Derbyshire
In C (NOT C+/C++!!), how do I do square root of a number?

Also how do I do powers. At the mo if I need d^3 I just do d*d*d.

I have the ability in C to do equations, and have done a few ones that work fine, I am just not sure on the above.
thanks
 
oh yea just noticed on the wrong section, oops.
At the top I have #include <stdio.h> iirc for all my programs and the other programs that do equations work ok afaik.
where would I put sqrt?? Say I had declared a double called A, before the fprintf line I would put A = sqrtA in order to assign the result back into A? Or I could just call it B or something if I had delared B as well at the start.
 
Back
Top Bottom