#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+CgppbnQgbWFpbih2b2lkKSB7CiAgICBpbnQgbjsgCiAgICBkb3VibGUgc3VtID0gMC4wOwoKIAogICAgcHJpbnRmKCJFbnRlciB0aGUgdmFsdWUgb2YgbjogIik7CiAgICBzY2FuZigiJWQiLCAmbik7CgogICAgZm9yIChpbnQgaSA9IDE7IGkgPD0gbjsgaSsrKSB7CiAgICAgICAgc3VtICs9IDEuMCAvIChpICogKGkgKyAxKSk7ICAKICAgIH0KCiAgICBwcmludGYoIlN1bSBvZiB0aGUgZmlyc3QgJWQgdGVybXMgb2YgdGhlIHNlcmllczogJS40ZlxuIiwgbiwgc3VtKTsKICAgIAogICAgcmV0dXJuIDA7Cn0K