Uva solution 10696 f91

#include<bits/stdc++.h>
using namespace std;
int f91(int n)
{
    int d;
    if(n<=100)
    {
        return f91(f91(n + 11));

    }
    else if(n>=101)
    {
         return n-10;
    }
}
int main()
{
    int n,m;
    while(1)
    {
    cin>>n;
    if(n==0)
    {
        return 0;
    }
    m=f91(n);
    cout<<"f91("<<n<<") = "<<m<<endl;
    }
    return 0;

}

Comments

Popular posts from this blog

Codeforces Solution 230B T-primes

Uri Solution 2747 Output 1