Advertisement
alias3glw

Cte-e Serie

May 27th, 2015
378
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. #include <iostream>
  2. #include <iomanip>
  3. /* run this program using the console pauser or add your own getch, system("pause") or input loop */
  4.  
  5. int main(int argc, char** argv) {
  6.    
  7.     double acum1,acum2,e;
  8.     int i;
  9.    
  10.     acum1=1;acum2=1;
  11.    
  12.     for (i=1 ; i<=7 ; i++){
  13.        
  14.         acum1=acum1*i;
  15.        
  16.         acum2=acum2+(1/acum1);     
  17.        
  18.     }
  19.    
  20.     std::cout<< std::fixed <<std:: setprecision(8);
  21.     std::cout<< acum2 << std::endl;
  22.    
  23.    
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement