{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

class_notes7

# 0 pow 9 5 is 30 fmod 123 21 is 18 fmod 235 102

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Math Library Functions From Fig. 5.2 (continued): Function pow(x,y) fmod(x,y) sin(x) cos(x) tan(x) Description x raised to power y ( xy ) Example pow( 2, 5 ) is 32.0 pow( 9, .5 ) is 3.0 fmod( 12.3, 2.1 ) is 1.8 fmod( 2.35, 1.02 ) is 0.31 sin( 0.0 ) is 0.0 sin( 3.14159/2 ) is 1.0 cos( 0.0 ) is 1.0 cos( 3.14159/2 ) is 0.0 tan( 0.0 ) is 0.0 tan( 3.14159/4 ) is 1.0 remainder of x/y as a floating point number trigonometric sine of x ( x in radians ) trigonometric cosine of x ( x in radians ) trigonometric tangent of x ( x in radians ) Example Program 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 /* using math library functions */ #include <stdio.h> #include <math.h> int main() { float pi = 3.14159; double i = sin( 3.14159 ); double j = sin( pi/2 ); float k = cos( pi/2 ); float l = tan( pi ); double m = 2.3e5; printf( printf( printf( printf( printf( "\ni "\nj "\nk "\nl "\nm is is is is is %...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online