Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace SandBox
- {
- using System;
- using System.Collections.Generic;
- public class EntryPoint
- {
- public static void Main()
- {
- int number = int.Parse(Console.ReadLine());
- List<long> sequence = new List<long>() { 1L, 1L };
- string output = string.Empty;
- if (number == 0)
- {
- output = "0";
- }
- else if (number == 1)
- {
- output = "1";
- }
- else
- {
- for (int i = 2; i < number; i++)
- {
- long nextNumberInSequence = sequence[i - 1] + sequence[i - 2];
- sequence.Add(nextNumberInSequence);
- }
- output = string.Join(" ", sequence);
- }
- Console.WriteLine(output);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement