while loop
sample output
a. 20 5 16 4 12 3 8 2 4 1
// 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--;
}
}
}
Comments
Leave a comment