Computer Science, asked by samarthgupta927, 2 months ago

Write a python program to print the table of any number ( Using for loop and while loop both)*

Output:
2 * 1 = 2
2 * 2 = 4
2 * 3 = 6 and so on

Answers

Answered by allysia
42

Language:

Python

Program:

number=int(input("Enter a number: "))

limit=int(input("Print table till: "))

for i in range(1,limit+1):

   print(f"{number}* {i} = {number* i }" )

Output:

Enter a number: 5

Print table till: 12

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

5* 11 = 55

5* 12 = 60

Logic:

  • Take number and upper limit as input.
  • Print the product as required in the asked format.

Attachment:

Attachments:
Answered by 8119sanjeevkumar
0

Answer:

n=int(input("Enter a number"))

i=1

while i<=10:

print(n,'x',I,'=',n*1)

Explanation:

Hope this is helpful

Similar questions