elsemTim

Untitled

Sep 21st, 2017
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.36 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApplication
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int A = Convert.ToInt32(Console.ReadLine());
  10.             int curValue = 1;
  11.             int count = 0;
  12.             while(curValue <= A)
  13.             {
  14.                 count++;
  15.                 int prevValue = curValue;
  16.                 curValue+= prevValue;
  17.             }
  18.             Console.WriteLine(curValue == A ? count : "-1");
  19.         }
  20.     }
  21. }
Add Comment
Please, Sign In to add comment