Advertisement
SkeptaProgrammer

Untitled

Sep 25th, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.47 KB | None | 0 0
  1. namespace Hello
  2. {
  3.     class Program
  4.     {
  5.         static void Main(string[] args)
  6.         {
  7.             var a = F(7);
  8.             Console.WriteLine(a);
  9.        
  10.         }
  11.         static int F(int n)
  12.         {
  13.             if (n > 2)
  14.                 return F(n - 1) + G(n - 2);
  15.             else return 1;
  16.         }
  17.         static int G(int n)
  18.         {
  19.             if (n > 2)
  20.                 return G(n - 1) + F(n - 2);
  21.             else return 1;
  22.         }
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement