View Code of Problem 30

#include <iostream>

inline unsigned int sigma(unsigned int n) {
    return n*(n+1)/2;
}

int main() {
    int n;
    while (std::cin >> n) {
        std::cout << sigma(n) << '\n';
    }
}

Double click to view unformatted code.


Back to problem 30