anon20016

Untitled

Dec 8th, 2019
115
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. }
RAW Paste Data