Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace CalculateSequence
- {
- using System;
- using System.Collections.Generic;
- public class Program
- {
- static void Main(string[] args)
- {
- int start = int.Parse(Console.ReadLine());
- Queue<int> queue = new Queue<int>();
- Console.Write(start + " ");
- for (int i = 0; i <= 50; i++)
- {
- queue.Enqueue(start + 1);
- queue.Enqueue((2 * start) + 1);
- queue.Enqueue(start + 2);
- start = queue.Dequeue();
- Console.Write(start);
- if (i != 50)
- {
- Console.Write(" ");
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement