Add a print statement to say “Multiplication Table” and then prompt the user to enter an integer. Your program should then print a “times table” for the numbers from 1 to the given integer (inclusive). That is, for input n, you would print a table of n rows (lines) each with n columns, where the cell at row i and column j contains the value i × j. The coding language must be Java.
Add a print statement to say “Multiplication Table” and then prompt the user to enter an integer. Your program should then print a “times table” for the numbers from 1 to the given integer (inclusive). That is, for input n, you would print a table of n rows (lines) each with n columns, where the cell at row i and column j contains the value i × j. The coding language must be Java.
Here we need to compute the multiplication upto the number entered by user.
So, this can be done using 2 for loops each running from 1 to n (user input) and printing the product values.
Algorithm:
1. Take input of number upto which table is to be printed
2.Run for loop from 1 to n
3.Run another nested for loop from 1 to n
4. Print values of product
5.Print newline
6. End
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images