loveefya1890 loveefya1890
  • 26-05-2022
  • Computers and Technology
contestada

write a program using a for loop, to display number 20 to 10 in descending order

Respuesta :

rvkacademic
rvkacademic rvkacademic
  • 30-05-2022

Answer:

public class MyProgram {

  public static void main(String[] args) {

     for (int i = 20; i >= 10; i--){

        System.out.println(i);

     }

  }

}

Explanation:

Since we are printing in descending order, we start with an initial value of 20, keep decrementing counter by 1 (the i-- part) until i reaches 20

Answer Link

Otras preguntas

which of the following is used to answer scientific question?A. IntuitionB. Opinion pollsC. ExperimentD. Imagination
the ratio of cats to dogs is 5 to 4 if there are a total of 63 cats and dogs how many dogs are there and how many cats ate there?
How many countries were represented at the Paris negotiations (Where the Treaty of Versailles was signed) in January 1919?
List the following events in chronological order
in order to secure power following vladimir lenin's death joseph stalin instituted policies designed to (apex)
The south’s country in the 1850 is best described as
Why did the United States help panama gain independence from Columbia site evidence from the text
Ribosomes use the directions found in dna to make
Which philosopher believed the path to new knowledge is by way of inductive reasoning? A. Francis bacon b. Isaac Newton c. Rene Descartes d. Andreas Vesalius
Find a polynomial, which if substituted for M will make the equation an identity: M + (5x^2 –2xy) = 6x^2 +9xy–y^2