Powers of two

Report a typo

Below is an unfinished program that should output all powers of two that are lower than the number entered by the user. Complete the while-loop 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();
         result = 1;

         ( < ) {
            System.out.println(result);
            result *= 2;
        }
    }
}
intresultnumlongwhiledo

Create a free account to access the full topic