Advertisement
qberik

Untitled

Oct 15th, 2021
950
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.40 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. int main(){
  7.   int n = 0, k = 0;
  8.   int fact = 0;
  9.   float sum1 = 0;
  10.   float sum2 = 0;
  11.  
  12.   for( k = 1; k <= 10; k++ ){
  13.     sum2 = 0;
  14.     for( n = 1; n <= k; n++ ){
  15.       sum2 += sin( k * n );
  16.     }
  17.  
  18.     fact = 1;
  19.     for( int i = 1; i <= k; i++ ){
  20.       fact *= i;
  21.     }
  22.     sum1 += ( sum2 / fact );
  23.   }
  24.   cout << sum1 << endl;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement