- using System;
- namespace ForgetCode
- {
- public class MainClass
- {
- public static void Main()
- {
- int x = 0, y = 1, z=0, nth, i;
- Console.WriteLine("\n\nPlease Enter The Term Number:");
- nth = Convert.ToInt32(Console.ReadLine());
- for (i = 1; i <= nth; i++)
- {
- z = x + y;
- x = y;
- y = z;
- }
- Console.WriteLine("\nthe {0}th term of Fibonacci Series is is {1}\n\n\n", nth, z);
- }
- }
- }
Output: |
---|
Please Enter The Term Number: |
5 |
the 5th term of Fibonacci Series is is 8 |