#include <stdio.h>
int main(void) {
int n;
double sum = 0.0;
printf("Enter the value of n: ");
for (int i = 1; i <= n; i++) {
sum += 1.0 / (i * (i + 1));
}
printf("Sum of the first %d terms of the series: %.4f\n", n
, sum
);
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgbWFpbih2b2lkKSB7CiAgICBpbnQgbjsgCiAgICBkb3VibGUgc3VtID0gMC4wOwoKICAgIHByaW50ZigiRW50ZXIgdGhlIHZhbHVlIG9mIG46ICIpOwogICAgc2NhbmYoIiVkIiwgJm4pOwoKICAgIGZvciAoaW50IGkgPSAxOyBpIDw9IG47IGkrKykgewogICAgICAgIHN1bSArPSAxLjAgLyAoaSAqIChpICsgMSkpOyAKICAgIH0KICAgIAogICAgcHJpbnRmKCJTdW0gb2YgdGhlIGZpcnN0ICVkIHRlcm1zIG9mIHRoZSBzZXJpZXM6ICUuNGZcbiIsIG4sIHN1bSk7CiAgICAKICAgIHJldHVybiAwOwp9Cg==