Solution for Exercise 11-11
ex1111
#include <stdio.h> #include <math.h> int main() { float result,value; printf("Input a float value: "); scanf("%f",&value); result = sqrt(value); printf("The square root of %.2f is %.2f\n",value,result); result = pow(value,3); printf("%.2f to the 3rd power is %.2f\n",value,result); result = floor(value); printf("The floor of %.2f is %.2f\n",value,result); result = ceil(value); printf("And the ceiling of %.2f is %.2f\n",value,result); return(0); }
Notes
* The %.2f
placeholder limits floating point output to two decimal places after the period.
* Here's a sample run using the value 45.3:
Copyright © 1997-2024 by QPBC.
All rights reserved