---
title: "Дано целое число N (&gt; 1). Последовательность чисел Фибоначчи FK определяется следующим образом: F1 = 1, F2 = 1, FK = FK−2 + FK−1, K = 3, 4, ... . Проверить, является ли число N числом Фибоначчи. Если является, то вывести TRUE, если нет — вывести FALSE."
description: "using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T..."
author: "dan_ntu"
published: "2017-02-25T06:23:36+00:00"
modified: "2017-02-25T06:23:51+00:00"
locale: "ru"
canonical_url: "https://yvision.kz/post/dano-celoe-chislo-n-gt-1-posledovatelnost-chisel-fibonachchi-fk-opredelyaetsya-sleduyushchim-obrazom-757725"
markdown_url: "https://yvision.kz/post/dano-celoe-chislo-n-gt-1-posledovatelnost-chisel-fibonachchi-fk-opredelyaetsya-sleduyushchim-obrazom-757725/markdown"
site_name: "Yvision.kz"
---

# Дано целое число N (&gt; 1). Последовательность чисел Фибоначчи FK определяется следующим образом: F1 = 1, F2 = 1, FK = FK−2 + FK−1, K = 3, 4, ... . Проверить, является ли число N числом Фибоначчи. Если является, то вывести TRUE, если нет — вывести FALSE.

> using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.T...

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace ConsoleApplication1

{

class Class1

{

static void Main(string[] args)

{

int n, f = 0, f1 = 1, f2 = 1;

Console.WriteLine("Введите целое положительное число N>1");

n = int.Parse(Console.ReadLine());

while (f < n)

{

f = f2 + f1;

f2 = f1;

f1 = f;

}

Console.WriteLine("Утверждение, что число {0} является числом Фибоначчи, - это {1}", n,(f==n));

Console.ReadLine();

}

}

}

---

Source: [https://yvision.kz/post/dano-celoe-chislo-n-gt-1-posledovatelnost-chisel-fibonachchi-fk-opredelyaetsya-sleduyushchim-obrazom-757725](https://yvision.kz/post/dano-celoe-chislo-n-gt-1-posledovatelnost-chisel-fibonachchi-fk-opredelyaetsya-sleduyushchim-obrazom-757725)