Advertisement
pavsavov

Aloops_U5

Feb 19th, 2017
187
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class u5 {
  4. public static void main(String[] args) {
  5.  
  6. Scanner scanner = new Scanner(System.in);
  7. int n = Integer.parseInt(scanner.nextLine());
  8. int num = 1;
  9.  
  10. for (int i = 1; i <= n; i++) {
  11. while (num < n) {
  12. System.out.println(num);
  13. num = num * 2 + 1;
  14. break;
  15.  
  16. }
  17. }
  18.  
  19. }
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement