C++ Find the sum of first n Natural Numbers

#include <iostream>

int main() {
    int n, sum = 0;

    std::cout << "Enter a positive integer n: ";
    std::cin >> n;

    for (int i = 1; i <= n; ++i) {
        sum += i;
    }

    std::cout << "Sum of first " << n << " natural numbers: " << sum;

    return 0;
}