/* title: mathLibraryFunction author: aeriqusyairi date: Jan21 2012 */ #include<stdio.h> #include<math.h> int main(){ //square root printf("%.2f\n", sqrt(9)); //exponential function e^x printf("%.2f\n", exp(1)); //natural logarithm of x (base e) printf("%.2f\n", log(2.718282)); //logarithm of x (base 10) printf("%.2f\n", log10(1)); //absolute value of x printf("%.2f\n", fabs(-13.5)); //round x to the smallest integer not less than x printf("%.2f\n", ceil(9.2)); //round x to the largest integer not greater than x printf("%.2f\n", floor(9.2)); //x raised to the power of y printf("%.2f\n", pow(2, 7)); //remainder of x/y as a floating point number printf("%.3f\n", fmod(13.657, 2.333)); //trigonometric sine of x (x in radian) printf("%.2f\n", sin(0.0)); //trigonometric cosine of x (x in radian) printf("%.2f\n", cos(0.0)); //trigonometric tangent of x (x in radian) printf("%.2f\n", tan(0.0)); system("pause"); return 0; }
My C Repository
C How to Program
Sweet thanks to my broski Yusuke Fiz for this Deitel book.
You light up my life dude.
Just another personal public repository.
Friday, March 16, 2012
Math Library Function
Example of the usage of the Math Library function.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment