Advertisement
Guest User

Untitled

a guest
Aug 21st, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text.RegularExpressions;
  4.  
  5. namespace ConsoleApp1
  6. {
  7. class Program
  8. {
  9. static int count(int n)
  10. {
  11. if (n == 1 || n == 2)
  12. return n;
  13. return count(n - 1) + count(n - 2);
  14. }
  15.  
  16. static void Main(string[] args)
  17. {
  18. int res = count(5);
  19.  
  20. Console.WriteLine(res);
  21. }
  22. }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement