Write a Function in C language that will allow floating point number to be raised to an integer power. (i.e. to calculate y= xn where x, y are floating point variables and n is an integer.
1
Expert's answer
2012-10-30T11:19:45-0400
float power(int pow, float from) // x power y { float temp = from; if(pow > 0) { --pow; for(int i = 0; i < pow; i++) temp *= from; } else if(pow < 0) { --pow; for(int i = 0; i > pow; --i) temp /= from; } else if (pow == 0) temp = 1; return temp; }
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment