Advertisement
Qrist

27

Apr 4th, 2020
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.53 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Unknown
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             Console.WriteLine("Please enter the number ");
  10.             int n = int.Parse(Console.ReadLine());
  11.             int a1 = 1;
  12.             int a2 = 1;
  13.             int b=0;
  14.             for (int i = 0; i < n; i++)
  15.             {
  16.                 b = a1 + a2;
  17.                 a2 = a1;
  18.                 a1 = b;
  19.                 Console.WriteLine("Fib : {0}+{1}={2} ",a1,a2,b);
  20.             }
  21.         }
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement