Question #285543

for loop sample output a. 19 17 15 13 11 9 7 5 3 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) throws java.lang.Exception
    {
        // use it to enter the number from keyboard
        //Scanner in = new Scanner(System.in);
        //int num = in.nextInt();
        int num = 19;
        for (int i = num; i > 0; i -= 2) {
            System.out.print(i + " ");
        }
    }
}
LATEST TUTORIALS
APPROVED BY CLIENTS