0% found this document useful (0 votes)
16 views3 pages

Multiplication Tables and Patterns in Python

The document contains code snippets to print multiplication tables, create star patterns, and print numbers from 0 to 100 in multiples of 10. It includes code using for loops and while loops to iterate through ranges and print out the desired outputs through each iteration.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views3 pages

Multiplication Tables and Patterns in Python

The document contains code snippets to print multiplication tables, create star patterns, and print numbers from 0 to 100 in multiples of 10. It includes code using for loops and while loops to iterate through ranges and print out the desired outputs through each iteration.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

To print any multiplication table

a = int(input('enter the number'))


b = int(input('enter the range'))

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

print(str(i) + " X " + str(a) + " = " + str(int(i * a)))

else:
print("copleted")

a = int(input('enter the number'))


b = int(input('enter the range'))

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

print(str(i) + " X " + str(a) + " = " + str(int(i * a)))

else:
print("copleted")
to make star pattern
row = int(input("Enter no of rows : "))

a="*"

stars_count = 1

while row > 0:

print(" "*row + a * stars_count)

row =row-1

stars_count =stars_count+ 1
row = int(input("Enter no of rows : "))

a="*"

stars_count = 1

while row > 0:

print(" "*row + a * stars_count)

row =row-1

stars_count =stars_count+ 1

result

* *

* * *

* * * *

* * * * *
For printing numbers from 0 to 100 as multiples of 10

for x in range (0,100,10):


print (x)

Result

10

20

30

40

50

60

70

80

90

You might also like