# How to use Pre-defined mathematical function in C language?

## Problem

How to find the cube root of any given number by using the C programming language?

## Solution

### Algorithm

Step 1: Enter any number at run time
Step 3: Compute result
Result:pow(number,1.0/3.0)
Step 4: Increment result
Step 5: Print result

## Example

Following is the C program to find the cube root of any given number −

//finding cube root of given number//
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main(){
int number, result;
printf("Enter any number: ");
scanf("%d",&number);
result=pow(number, 1.0/3.0);
result++;
printf("\Cube of %d is: %d",number,result);
getch();
}

## Output

When the above program is executed, it produces the following result −

Cube of 4 is 64

## Example

Consider another example by using math function.

#include <stdio.h>
#include <math.h>
int main (){
float num1, num2, num3;
printf("enter 3 numbers:");
scanf("%f %f %f",&num1,&num2,&num3) ;
printf ("number1 = %.1lf", ceil(num1));
printf ("number2 = %.1lf", ceil(num2));
printf ("number3 = %.1lf", ceil(num3));
return(0);
}

## Output

When the above program is executed, it produces the following result −

enter 3 numbers:
3.7 -4.2 -6.7
number1 = 4.0
number2 = -4.0
number3 = -6.0