12345678910111213141516171819202122232425262728 |
- #include <stdio.h>
- double calculateFactorial(int n) {
- if (n == 0) {
- return 1;
- } else {
- return n * calculateFactorial(n - 1);
- }
- }
- int main() {
- double x, result = 1.0;
- int n;
-
- scanf("%lf %d", &x, &n);
- int i,j;
- for (i = 1; i <= n; i++) {
- double term = 1.0;
- for (j = 1; j <= i; j++) {
- term *= x / j;
- }
- result += term;
- }
-
- printf("%.6f\n", result);
-
- return 0;
- }
|