aneliabogeva

Sequence2kPlus1

Dec 13th, 2020
38
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.util.Scanner;
  2.  
  3. public class Sequence2kPlus1 {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         Integer n = scanner.nextInt();
  7.         Integer number = 1;
  8.  
  9.         while (number <= n){
  10.             System.out.println(number);
  11.             number = number*2+1;
  12.         }
  13.  
  14.     }
  15. }
  16.  
RAW Paste Data