Untitled

mail@pastecode.io avatar
unknown
c_cpp
a month ago
274 B
0
Indexable
Never
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int qwe(int n)
{
    if (n == 1)
    {
        return 1;
    }
    else
    {
        return n + qwe(n - 1);
    }
}
int main()
{
    int n;
    cin >> n;
    cout << qwe(n);
}
Leave a Comment