Powers of two

Report a typo

You're given an unfinished program that should output all powers of two that are lower than the number entered by the user. Complete the for-loop parts so that the program will work correctly.

Fill in the gaps with the relevant elements
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);

        long num = scanner.nextLong();

        for ( i = 1; i < ; ) {
            System.out.println();
        }
    }
}
i++inti *= 2longinum

Create a free account to access the full topic