Ask Question
11 November, 22:56

Write a method printSquare that accepts min and max integers and prints a square of lines of increasing numbers. The first line should start with the minimum; each line that follows should start with the next-higher number. The numbers on a line wrap back to the minimum after it hits the maximum. For example, the call: printSquare3, 6); should produce the following output: 3456 4563 5634 6345

+4
Answers (1)
  1. 11 November, 23:49
    0
    public class PrintSquare {

    public static void printSquare (int min, int max) {

    for (int i = min; i < = max; i++) {

    for (int j = 0; j < (max - min + 1); j++) {

    if (i + j < = max)

    System. out. print (i + j);

    else

    System. out. print (i+j - max + min - 1);

    }

    System. out. println ();

    }

    }

    public static void main (String[] args) {

    printSquare (3, 6);

    }

    }
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Write a method printSquare that accepts min and max integers and prints a square of lines of increasing numbers. The first line should ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers