Q:

Write a python program to print multiplication table of a given number

1

Write a program to print multiplication table of a given number

For example, num = 2 so the output should be

2
4
6
8
10
12
14
16
18
20

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

Hint:

  • Set n =2
  • Use for loop to iterate the first 10 numbers
  • In each iteration, multiply 2 by the current number.( p = n*i)
  • Print p

Solution:

n = 2
# stop: 11 (because range never include stop number in result)
# run loop 10 times
for i in range(1, 11, 1):
    # 2 *i (current number)
    product = n * i
    print(product)

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now