Pages

Tuesday 2 October 2012

UVA - 10696 - f91

#include <stdio.h>

int f91(int x){
    if(x>100)
        return x-10;
    return f91(f91(x+11));
}

int main()
{
        int x;
        while(1){
            scanf("%d",&x);
            if(x==0)
                break;
            printf("f91(%d) = %d\n",x,f91(x));
        }
    return 0;
}

No comments:

Post a Comment