#include <iostream>
#include <cmath>
int main() {
int N;
std::cout << "Ingrese el valor de N: ";
std::cin >> N;
if (N <= 0) {
std::cout << "El valor de N debe ser un número entero positivo." << std::endl;
return 1;
}
for (int i = 0; i < N; ++i) {
std::cout << "2^" << i << " = " << static_cast<int>(pow(2, i)) << std::endl;
}
return 0;
}
To embed this program on your website, copy the following code and paste it into your website's HTML: