Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Tho_fibonacci_23_11_2019
- {
- class Program
- {
- //static int n
- static int so_tho(int n)
- {
- if (n == 1) return 1;
- else if (n == 2) return 1;
- else return (so_tho(n - 1) + so_tho(n - 2));
- }
- static void Main(string[] args)
- {
- int n;
- Console.Write("nhap thang: ");
- n = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine(+so_tho(n));
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement