View Code of Problem 108

#include <iostream>
using namespace std;

long int f(long int n){
    if(n==1||n==2)
        return n;
    else
        return f(n-1)+f(n-2);
}

int main(){
    long int n,k;
    double num;
    scanf("%ld",&n);
    while(n--){
        scanf("%lf",&num);
        k=0;
        while(num){
            num/=10;
            k++;
        }
        printf("%ld\n",f(k));
    }
    return 0;
}

Double click to view unformatted code.


Back to problem 108