Write a program to print the multiplication table of a given number. The number has to be entered by the user. (Use while loop) in python
Answers
Explanation:
program :-
'''multiplication table in Python'''
num=input("Enter the number for multiplication table: ");
#get input from user
#use for loop to iterates 1 times for i in range(1,11):
print(num,'x',i,'=',num*i) #for
display multiplication table
result
Enter the number for multiplication table:
12
12x1=12
12x2=24
12x3=36
12x4=48
12x5=60
12x6=72
12x7=84
12x8=96
12x9=108
12x10=112
program with loop
num=input("Enter the number for
multiplication table: \n");
#get input from user
i=0;
while i<=num:
#use for loop to iterates 1 times
i+=1;
print(num,'x',i,'=',num*i)
result:-
Enter the number for multiplication table:
12
12x1=12
12x2=24
12x3=36
12x4=48
12x5=60
12x6=72
12x7=84
12x8=96
12x9=108
12x10=120
12x11=132
12x12=144
12x13=156
Answer:
n=int(input("enter a no.")
s=2
for n in range(0,10):
a=s*n
print(a)