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

6 > 3p + 9 could u also show work
HELP PLEASE Why doesn't the Earth's shadow fall on the Moon during the Full Moon phase? The Moon's orbit isn't flat, it's tilted The Earth is much larger than t
I need help on how to fill a deposit slip, please someone help with details and dont abuse for points.. I want to learn how rather than give the answer.​
Where is point K(-100, 100)located?​
Please help solve this.
PART B: Which of the following quotes best supports the answer to Part A? A. “The New World served as the stage for a small but significant part of the struggle
which sentence has the most objective tone? 1. people always think danger won’t happen to them. 2. learning to swim is the most important skill to learn as a ch
3 In science, what is a system of ideas that explains many related observations and is supported by a large body of evidence A.)Hypothesis B.)theory
Raw data are observations or data points that
Work out the value of 10000^-1/2