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