Odpowiedź:
#include <iostream>
int main() {
int a, n;
std::cout <<"Podaj liczbe ktorej potege chcesz policzyc\n";
std::cin >> a;
std::cout <<"Podaj do ktorej potegi chcesz podniesc liczbe\n";
std::cin >> n;
int ans = 1;
int i = 0;
while(i < n){
ans *= a;
i++;
}
std::cout << ans;
return 0;
}
Wyjaśnienie: