Advertisement
daniv1

29.7

Oct 29th, 2018
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.49 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <math.h>
  3.  
  4. double product(unsigned int n)
  5. {
  6.     double res = 1;
  7.     for(unsigned int i = 1; i <= n; ++i)
  8.     {
  9.  
  10.         res*=(pow(i,2)+4)/(2.5*i);
  11.  
  12.     }
  13.     return res;
  14. }
  15.  
  16. double sum(unsigned int n)
  17. {
  18.     double res = 0;
  19.     for(unsigned int i = 1; i <= n; ++i)
  20.     {
  21.         res+=(pow(i,3)+6)/(10.0 *i +1.0);
  22.     }
  23.     return res;
  24. }
  25.  
  26. int main()
  27. {
  28.     unsigned int n = 9;
  29.     double res = product(n)*sum(n);
  30.     printf("res = %.4lf\n",res);
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement