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

Expand your answer for me plz. What kind of energy is used when throwing a baseball? When you catch the ball, is the energy gained or lost? Enter your answer i
Construct your own division problem with a two-digit divisor that has a quotient of 6 and a remainder of 12 but is not equivalent to 156 divided by 24
Why did African American leaders urge African Americans to enlist in the Union army?
Is it okay if a college essay is less than the max amount of characters?
Need help with 7 and 8
If we flip 6 coins what is the probability of getting at least 2 heads
Label and name parts or plant and animal cells 6th grade
What were the contributions of Germany, Czechoslovakia, Ireland and Mexico cultures in Texas?
Which represents the reflection of f(x) = square root of x over the x-axis?
Review Article 1, Section 10 here. Write two or three sentences explaining whether this article grants more power to the states or the federal government. Give