/* File: math.c Use of some functions in the math library. Compile using: gcc -Wall math.c -lm */ #include // Must have the following line #include // A constant #define PI 3.1415927 int main() { double x, y ; double z ; printf("x = ") ; // prompt for x scanf("%lf", &x) ; printf("y = " ) ; // promput for y scanf("%lf", &y) ; // Compute some values using x & y z = sqrt(x) ; printf("The square root of %f is %f\n", x, z) ; printf("x^y = %f\n", pow(x,y)) ; printf("sin( %f * PI ) = %f\n", y, sin(PI*y) ) ; return 0 ; }