Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include "math.h"
- #include "iostream"
- #include "iomanip"
- using namespace std;
- int main()
- {
- int k , i , g = 1 , n = 0 ;
- cout << " Vvedite k = " ;
- cin >> k ;
- for (int i = 1; i <= k ; i ++)
- {
- g *= 3;
- n += g;
- }
- cout << " Summa pervih n chlenov ravna " << n << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement