Advertisement
tchenkov

L07u05_Sequence2kPlus1

Feb 21st, 2017
210
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.41 KB | None | 0 0
  1. package Uprajneniq;
  2.  
  3. import java.util.Scanner;
  4.  
  5. /**
  6.  * Created by todor on 20.02.2017 г..
  7.  */
  8. public class u05_Sequence2kPlus1 {
  9.     public static void main(String[] args) {
  10.         Scanner scan = new Scanner(System.in);
  11.         int n = Integer.parseInt(scan.nextLine());
  12.         int num = 1;
  13.         while (num <= n){
  14.             System.out.println(num);
  15.             num = 2* num + 1;
  16.         }
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement