Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _CRT_SECURE_NO_WARNINGS
- #include <iostream>
- using namespace std;
- int main() {
- setlocale(LC_ALL, "Russian");
- int n;
- float a;
- scanf("%f %d", &a, &n);
- float s = 0;
- for (int j = 1; j <= n; j++) {
- float c = 1;
- for (int i = 0; i < j; i++) {
- c = c * a;
- }
- s = s + c;
- }
- printf("%f", s);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement