in this question, i have been tasked to write a program that prints pi basing on madava series, using pi() function and power() function.

The issue is that, when i use power(), i dont get the actual value of pi.

This is the source code i have written.

```
#include<stdio.h>
#include<math.h>
double pi();
int power(int x, int y);
int n;
int main()
{
double ret;
ret=pi();
printf("%.16f",ret);
}
double pi()
{
double j, result;
int x, k, n;
printf("Input value of n:");
scanf("%d",&n);
result=0;
for( k=0; k<n; k++ )
{
result+=(power((-1),(k))/ power((2*k+1.3),k)) ;
}
j=(sqrt(12))*result;
return j;
}
int power(int x, int y)
{
int res = 1;
for( y; y>0; y--)
{
res = res*x;
}
return res;
}
```