Advertisement
Guest User

Untitled

a guest
Oct 20th, 2016
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.44 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2. #include <stdio.h>
  3. #include <conio.h>
  4. #include <math.h>
  5. #include <float.h>
  6. #include <locale.h>
  7.  
  8. double FTWTRYHARD(const double a, const int n) {
  9.     double temp = a;
  10.     double result = 1.0 / a;   
  11.     for (int i = 1; i <= n; i += 1) {
  12.         temp *= (a + i);
  13.         result += 1.0 / temp;
  14.     }
  15.     return result;
  16. }
  17.  
  18. int main() {
  19.     int n;
  20.     double a;
  21.     scanf("%lf%i", &a, &n);
  22.     printf("%.4f\n", FTWTRYHARD(a, n));
  23.     _getch();
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement