#include <iostream>

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 = 1; i <= N; ++i) {
        int sumaAcumulativa = 0;
        for (int j = 1; j <= i; ++j) {
            sumaAcumulativa += j;
            if (j > 1) std::cout << " + ";
            std::cout << j;
        }
        std::cout << " = " << sumaAcumulativa << std::endl;
    }

    return 0;
}

Embed on website

To embed this program on your website, copy the following code and paste it into your website's HTML: