/* File: math1.c This program demonstrates the use of some functions in the math library. */ #include // The following preprocessor directive is necessary // if you want to use the math library functions. #include // The following preprocessor directive defines // the constant PI #define PI 3.1415927 main() { double x, y ; double z ; printf("x = ") ; // prompt for x scanf("%lf", &x) ; printf("y = " ) ; // prompt 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(PI * %f) = %f\n", y, sin(PI*y) ) ; }