Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApplication9
- {
- class Program
- {
- static void Main()
- {
- int n = int.Parse(Console.ReadLine());
- int a = 0;
- int b = 1;
- int c = 0;
- if ( n == 1 || n == 0 )
- {
- Console.WriteLine(a);
- }
- else
- {
- Console.Write("{0}, {1}", a, b);
- for (int i = 0; i < n - 2; i++)
- {
- c = a + b;
- Console.Write(", " + c);
- a = b;
- b = c;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement