#include <stdio.h>
#include <math.h>
#define EPSILON 1.0e-8
int main() {
double sum, term;
int p, i;
p = 1;
sum = 1.0;
for (i = 1;; i++) {
/* break-condition */
if ((term = 1.0 / (p = p * i)) < EPSILON)
break;
sum += term;
}
printf("result: %+.12f\n", sum
); return 0;
}
/* end */
I2luY2x1ZGUgPHN0ZGlvLmg+CiNpbmNsdWRlIDxtYXRoLmg+CgojZGVmaW5lIEVQU0lMT04gMS4wZS04CmludCBtYWluKCkgewogIGRvdWJsZSBzdW0sIHRlcm07CiAgaW50IHAsIGk7CiAgcCA9IDE7CiAgc3VtID0gMS4wOwogIGZvciAoaSA9IDE7OyBpKyspIHsKICAgIC8qIGJyZWFrLWNvbmRpdGlvbiAqLwogICAgaWYgKCh0ZXJtID0gMS4wIC8gKHAgPSBwICogaSkpIDwgRVBTSUxPTikKICAgICAgYnJlYWs7CiAgICBzdW0gKz0gdGVybTsKICB9CiAgcHJpbnRmKCIgICAgICAgICArMC4xMjM0NTY3XG4iKTsKICBwcmludGYoInJlc3VsdDogICUrLjEyZlxuIiwgc3VtKTsKICBwcmludGYoImV4cCgxKSA9ICUrLjEyZlxuIiwgZXhwKDEuMCkpOwogIHByaW50ZigiZGlmZjogICAgJSsuMTJmXG4iLCBzdW0gLSBleHAoMS4wKSk7CiAgcmV0dXJuIDA7Cn0KLyogZW5kICov