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

7. Which kind of relationship did Spanish colonists have with Native Americans The two groups were equals. Colonists ignored Native Americans. Native Americans
Resolve into factors: 81a3 + 3b3
For each 50 mm of coloured fabric Nick uses to make his curtains, he also uses 10 cm of white fabric. Express the amount of white fabric to coloured fabric as a
Choose one : Difference between Horticultural and Cooperative farming Or Difference between truck farming and Dairy farming . ( write in points )
answer please.........​
Which student’s first step was incorrect, and why?
Plzz help me with dis everything is on the image below
Mixed Naming Worksheet – Ionic, Covalent and Acids Directions: Be sure to determine what type of compound your substance is – ionic, binary, covalent or an acid
He usually....in the morning. (walk/walks/walked)​
f(x) = -2? + 10x- 6 Find f(-5)