Advertisement
SergeyPGUTI

3.2.10(через формулу)

Sep 30th, 2015
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.26 KB | None | 0 0
  1. #include <iostream>
  2. #include <cmath>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     int n;
  9.     double a,An=1;
  10.     double Sum=1;
  11.     cin>>a>>n;
  12.     for(int i=1;i<=(n+1);i++)
  13.     {
  14.         An*=a;
  15.     }
  16.     Sum=(An-1)/(a-1);
  17.     cout<<Sum;
  18.     return 0;
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement