Write a program using following equation.
Program:
#include<stdio.h>
#include<math.h>
main()
{
int n, i;
float x,sum=0,y;
printf("Enter N = ");
scanf("%d", &n);
printf("Enter X = ");
scanf("%f", &x);
y=(x-1)/x;
for(i=2; i<=n; i++)
{
sum=sum+(pow(y,i)*.5);
}
printf("Sum=%f", sum+y);
}