Advertisement
anon20016

Untitled

Dec 8th, 2019
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS
  2.  
  3. #include <iostream>
  4. using namespace std;
  5.  
  6. int main() {
  7. setlocale(LC_ALL, "Russian");
  8. int n;
  9. float a;
  10. scanf("%f %d", &a, &n);
  11.  
  12. float s = 0;
  13. for (int j = 1; j <= n; j++) {
  14. float c = 1;
  15. for (int i = 0; i < j; i++) {
  16. c = c * a;
  17. }
  18. s = s + c;
  19. }
  20. printf("%f", s);
  21.  
  22. return 0;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement