1 solutions

  • 0
    @ 2024-8-23 20:08:50
    #include<iostream>
    #include<cmath>
    using namespace std;
    int f(int n)
    {
        if(n==1)
            return 1;
        else
            return n+f(n-1);
    }
    int main()
    {
        int n;
        cin>>n;
        cout<<f(n)<<endl;
        cin>>n;
    }
    
    • 1

    Information

    ID
    935
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    1
    Tags
    (None)
    # Submissions
    44
    Accepted
    30
    Uploaded By