Is Fibo : HackerRank Problem Solution

Is Fibo : HackerRank Problem Solution


C Implementation:

#include <stdio.h>
#include <string.h>
#include <math.h>
#include <stdlib.h>
#define MAX 1000000
unsigned long long int checkfibo(unsigned long long int N)
    {
    unsigned long long int f[MAX],i;
    f[0]=0;
    f[1]=1;
    i=1;
    for(;f[i]<N;i++)
        f[i+1]=f[(i+1)-1]+f[(i+1)-2];
    return (f[i]==N);
}


int main() {

    unsigned long long int T,N;
    scanf("%llu",&T);
    while(T--)
        {
        scanf("%llu",&N);
        if(checkfibo(N))
            printf("IsFibo\n");
        else
            printf("IsNotFibo\n");
    }
    return 0;
}