Question #285989

while loop


sample output


a. 20 5 16 4 12 3 8 2 4 1



Expert's answer

// use it to enter the number from keyboard
//import java.util.Scanner;

public class Main
{
    public static void main (String[] args)
    {
        // use it to enter the number from keyboard
        //Scanner in = new Scanner(System.in);
        //int num = in.nextInt();
        int num = 5;
        while (num > 0) {
            System.out.print(num * 4 + " " + num + " ");
            num--;
        }
    }
}
LATEST TUTORIALS
APPROVED BY CLIENTS