You are on page 1of 1

#include <stdio.

h>
#include <math.h>

int main() {
int i = 0, n, power;
float sum = 0.0;

printf("Enter the value for n:");


scanf("%d", &n);

while (i <= n) {
printf("+ 1/(n^%d)", i);
sum = sum + 1.0 / pow(n, i);
i++;
}

printf("\nResult: %f\n", sum);


return 0;
}

You might also like