Table Printing: Introducing the Range

Learn to print tables or sequences within the given range.

This lesson builds on the last lesson on loops and introduces several sentinel conditions on loops to solve different kinds of scenarios. Let’s look at them.

Printing the table up to a certain limit

You may have noticed that so far in our programs when wanting to set a limit, we’ve had to keep changing the code. For example, if we required the multiplication table up to the 20th or 30th multiple, we would need to change the code again.

Look at the following example to see how we can handle this issue.

The “Run” button is disabled by default because this program requires two integers as inputs. When entering multiple inputs, we enter each input, followed by a space or an enter key, and then the next input.

When you’ve entered all inputs, click the “Run” button.

Get hands-on with 1200+ tech skills courses.