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

4 in. 8. 6.7x = 5.2x + 12.3 11 2(n-3) = 4n+1 What is the answer?
What is the first step of a summary
Can someone help me pleaseee
3. 6.7x = 5.2x + 12.3 What is the answer?
The path of a skateboarder along a ramp at a new skate park is shown below, where the starting position is on the left side of the ramp. Which statement is true
You place an object 20 cm from a lens and find an image on the opposite side 30 cm from the lens. You calculate a focal length of 12 cm. You then move the objec
Which statement is true according to Newton's second law of motion? A. An object accelerates in the direction opposite to the direction of the force applied. B
Solve for x: 3 − (2x − 5) < −4(x + 2) A. x < −8 B. x > −8 C. x < −3 D. x > −3
3w - 6+2w =-2 + w What is the answer
For a person with a Near Point (NP) = 45 cm, what would be his prescription's lens power = _________ diopters