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);
}
Output
Input a float value: 45.3
The square root of 45.30 is 6.73
45.30 to the 3rd power is 92959.67
The floor of 45.30 is 45.00
And the ceiling of 45.30 is 46.00
Notes
* The %.2f placeholder limits floating point output to two decimal places after the period.
Copyright © 1997-2025 by QPBC.
All rights reserved
