English, asked by Rainbowgain, 2 months ago

Write a program to print first 20 even numbers in descending order​

Answers

Answered by deepakkumar9254
5

\underbrace{Logic\:\:of\:\:program}

The no. which is at last in the series of the first 20 even numbers, will be used as the first no. as it is given in the question that we have to print series in descending order​. Then the next even number is extracted by subtracted 2 from the original number. Likewise, this series will be printed.

Program :-

class d              \\class declaration

{

   public static void main (String args[]) \\main() method declaration

   {

       System.out.println("First 20 even numbers in descending order​");

       for (int i = 40; i>=2; i-=2)

       {

           System.out.println(i);

       }

   }

}

Output :-

First 20 even numbers in descending order​

40

38

36

34

32

30

28

26

24

22

20

18

16

14

12

10

8

6

4

2

Glossary :-

\begin{array}{| c | c | c |}\cline{1-3} \bf Variable & \bf Type & \bf Description \\ \cline{1-3} i &\sf int & to\:\:run\:\:the\:\:lo{o}p\\ \cline{1-3}\end{array}

Similar questions