Find the cube of any number using the function.
#include <stdio.h>
double cube(double x)
{
return (x * x * x);
}
int main()
{
int x;
double c;
/* Input xber to find cube from user */
printf("Enter any x: ");
scanf("%d", &x);
c = cube(x);
printf("Cube of %d is %.2f", x, c);
return 0;
}
/**
* Function to find cube of any xber
*/
Output
Enter any x : 5
Cube of 5 is 125.00
0 Comments