QrDroid



Sharecodepoint popular queries

Saturday, 1 December 2018

Program to printing table by taking the number from user in phython

How to printing the table by taking value from user in python. We have displayed the multiplication table of variable num. 

In this program we taking the input from user and multiple the number (nums*num) num (1,2,3,4,5,6,7,8,9,10) , nums (user enter value). We are taking range(1,11) because by default start with 0 - 9 but we want to start 1.  Then we take the  range (1,11). 

Python Code :
num = 2
nums = int(input("Enter the any number "))
for num in range(1,11):
    mul = nums*num
    print(nums, '*', num, '=', mul)

Output  1:

Enter the any number 5
5
10
15
20
25
30
35
40
45
50

Process finished with exit code 0

Output 2 :

Enter the any number 5
5 * 1 = 5
5 * 2 = 10
5 * 3 = 15
5 * 4 = 20
5 * 5 = 25
5 * 6 = 30
5 * 7 = 35
5 * 8 = 40
5 * 9 = 45
5 * 10 = 50

Process finished with exit code 0

0 comments:

Post a Comment

 

Version 20.2.1 - 2016 - 2018 - © Sharecodepoint | Made in India. | Copyright Content