Challenge 1: Multiplication Table of a Number

Let's try printing the multiplication table of a number in this lesson.

Problem statement

Write a piece of code that will:

  • Print the multiplication table of a number $num up to 10.
  • You have to use while loop for solving this problem.
  • Your code should return the string $ans with all the values computed from multiplication appended in that string.
    • Here’s a link showing how you can add values to a string.


An integer.


A string.

Sample Input:


Sample output

Here’s an illustration showing what the string $ans should have stored in it at the end of the while loop for the above mentioned input.

Create a free account to access the full course.

By signing up, you agree to Educative's Terms of Service and Privacy Policy