Exercise 1: Multiplication Table Of a Number
In this exercise, you have to print the multiplication table of a number up to 10
We'll cover the following
Problem Statement
Write a code which will
- Print the multiplication table of a
number
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.
Note: You can use the to_string( ) function to add values to the string.
Example
Input: int num
= 5
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