C Language: Maths Inbuilt Functions 2

pow():

X to the power y

powl():

Same as pow for long double

pow10():

Any number raise to the power 10

pow10l():

same as above for long double

pow(2,3) 8
pow(3,2) 9
pow10(2) 100
pow10(3) 1000

```#include <stdio.h>
#include<math.h>

int main()
{
double x = 2.0, y = 3.0;
long double x1=2.0,y1=5.0;
float a=2,b=3;
printf("%f raised to %f is %f\n",a,b,pow(a,b));
printf("%lf raised to %lf is %lf\n", x, y, pow(x,y));
printf("%Lf raised to %Lf is %Lf\n", x1, y1, powl(x1, y1));
printf("\n10 raised to the power 2 is %lf\n",pow10(2));
printf("\n10 raised to the power 3 is %Lf\n",pow10(3));
return 0;
}
```
```/* Output */

2.000000 raised to 3.000000 is 8.000000
2.000000 raised to 3.000000 is 8.000000
-0.000000 raised to 0.000000 is 8.125012
10 raised to the power 2 is 100.000000
10 raised to the power 3 is 1000.000000
```

Sqrt():

Square root of a number

Sqrtl():

Same for long double

```#include <stdio.h>
#include<math.h>

int main()
{
double x = 4.0, result;
double x1=64,r1;
result = sqrt(x);
r1=sqrtl(x1);
printf("square root of %lf is %lf\n",x, result);
printf("square root of %lf is %lf\n",x1,r1);
return 0;
}
```
```/* Output */

square root of 4.000000 is 2.000000
square root of 64.000000 is 8.000000
```

Important Pages