Preview:
#include<stdio.h>
#include<string.h>

int check_fibonacci(int fibonacci[], int total)
{
    int i, j, result, sum;

    for(i = 0, j = 2; i < total - 2; i++,j++)
    {
        sum = fibonacci[i] + fibonacci[i+1];

        if(fibonacci[j] == sum)
        {
           result = 1;
        }
        else
        {
            result = 0;
        }
    }
    return result;
}


void main()
{

  int total;
  printf("co bao nhieu so : ");
  scanf("%d", &total);
  int fibonacci[total];

  for(int i = 0; i < total; i++)
  {
      printf("fibonacci %d = ", i + 1);
      scanf("%d", &fibonacci[i]);
  }

   if(check_fibonacci(fibonacci, total) == 1)
   {
       printf("\nla day so fibonacci");
   }
   else
   {
      printf("\nkhong phai day so fibonacci");
   }

}
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter