Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class Sequence2kPlus1 {
- public static void main(String[] args) {
- Scanner scanner = new Scanner(System.in);
- Integer n = scanner.nextInt();
- Integer number = 1;
- while (number <= n){
- System.out.println(number);
- number = number*2+1;
- }
- }
- }
Add Comment
Please, Sign In to add comment