Advertisement
Grimmjow1

02. Sequence 2k+1

Feb 2nd, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.35 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _2K_1
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int n = int.Parse(Console.ReadLine());
  10.             int k = 1;
  11.             while (k <= n)
  12.             {
  13.                 Console.WriteLine(k);
  14.                 k = 2 * k + 1;
  15.                
  16.             }
  17.         }
  18.     }
  19. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement