Use a for loop to print all of the numbers from 23 to 89, with 10 numbers on each line (the last line will have less than 10 numbers). Print one space between each number.
Hint - think about what values would be at the end of each line and what they have in common (think about modular division). You can then add an if block inside your loop which prints a new line when one of these numbers is encountered
Programming language: Java

Respuesta :

public class MyClass {

   public static void main(String args[]) {

       int count = 0;

     for (int i = 29; i < 90; i++){

         if (count == 9){

             System.out.println(i);

             count = 0;

         }

         else{

             System.out.print(i + " ");

             count++;

         }

         

     }

   }

}

I hope this helps!

Loops are used for operations that are to be performed repeatedly.

The for loop in Java is as follows:

for(int i = 23; i<=89; i++){

     System.out.print(i+" ");

     if(i%10==2){

         System.out.println();

     }

 }

The flow of the program segment is as follows:

//This iterates from 23 to 89

for(int i = 23; i<=89; i++){

//This prints all numbers from 23 to 29

     System.out.print(i+" ");

//The following if condition prints a line, after 10 numbers have been printed

     if(i%10==2){

         System.out.println();

     }

 }

See attachment for complete program and the sample run

Read more about similar programs at:

https://brainly.com/question/19309140

Ver imagen MrRoyal