a program that prints a pattern similar to the following pattern in the expected output below. Prompt
Question:
a program that prints a pattern similar to the following pattern in the expected output below.
Prompt the user for two integers between 1 and 10, representing number of rows and columns and print a grid of integers from 1 to (rows * columns).
Keep prompting the user for a value until the user presses 'n' or 'N' for No.
If the user enters 'y' or 'Y' for yes, then prompt again for the rows and columns and display the grid.. If an 'n' or 'N' is entered, then quit the program.
Hint: use nested for loops
Expected output:
Welcome to the Grid Pattern Program Enter the number of rows (1 -10 ): 4 Enter the number of column (1-10) :6 1, 5, 9, 13, 17, 21 2, 6, 10, 14, 18, 22 3, 7, 11, 15, 19, 23 4, 8, 12, 16, 20, 24 Do you want to do it again? Press 'Y' for yes and 'N' for No: Y Enter the number of rows (1 -10 ): 12 Please enter a number between 1 -10: 3 Enter the number of column (1-10) :14 Please enter a number between 1-10: 3 1, 4, 7 2, 5, 8 3, 6, 9 Do you want to do it again? Press 'Y' for yes and 'N' for No: N Goodbye!! |
Introduction to Java Programming, Comprehensive Version
ISBN: 978-0133761313
10th Edition
Authors: Y. Daniel Liang