Welcome to W3Courses
 Like Us on Facebook

Power

Source Code for Math Functions Log10 Floor Round Power Square Root in C Programming

Following is the source code for math functions Log10, Floor, Round, Power, and Square Root:

#include <math.h>
main()
{
        printf("%f %f\n",log10(64)/log10(2),pow(32,0.2));
        printf("%f %f\n",floor(6.6),rint(6.6));
        printf("%f\n",pow(12,3));
        printf("%f\n",sqrt(25));
}

Share

Power Function using Scheme Source Code

Power function code. Computes like 2^5 = 32

CODE
(define power
(lambda( x y)
(cond((eqv? y 0) 1)
((> y 0) (* (power x (- y 1)) x)))))

Share