python loop

#include <iostream>

int main() {
    // Declare variables
    int n;

    // Get user input
    std::cout << "Enter a number: ";
    std::cin >> n;

    // Initialize sum variable
    int sum = 0;

    // Python-style loop to calculate the sum of numbers from 1 to n
    for (int i = 1; i <= n; ++i) {
        sum += i;
    }

    // Display the sum
    std::cout << "The sum of numbers from 1 to " << n << " is: " << sum << std::endl;

    return 0;
}