# Multiplication without multiplication for numbers in range 10-199, Vedic Maths

print("This trick only works for range 10 to 199 included")

num1 = int(input("Enter 1st no.:"))
num2 = int(input("Enter 2nd no.:"))

max1 = max(num1, num2)
min1 = min(num1, num2 )

cond = (min1 > 9) and (max1 < 200)

def print2(res1, res2):
res3 = num1+num2-100
res4 = (num1-100) * (num2 -100)
print(f"""
Step 1 :
{num1} is {num1-100} greater than 100
And
{num2} is {num2-100} greater than 100
Hence,
The first 2 digits are 100+({num1-100})+({num2-100}) = {res3}
The last digits are {num1-100} * {num2 -100} = {res4}

Total {res1}{res2}
""")
def print1(res1, res2):
print(f"""
Step 1 :
{num1} is {num1-100} greater than 100
And
{num2} is {num2-100} greater than 100
Hence,
The first 3 digits are 100+({num1-100})+({num2-100}) = {res1}
The last 2 digits are {num1-100} * {num2 -100} = {res2}
Total {res1}{res2}
""")

def check_len(res1, res2):
if len(str(res2)) < 2:
res2 = str(0)+str(res2)
print1(res1, res2)

elif len(str(res2)) > 2:
res1 = res1 + int(str(res2)[:-2])
res2 = str(res2)[-2:]
print2(res1, res2)

def main(num1, num2):
res1 = num1 + num2 - 100
res2 = (num1-100)*(num2-100)

if cond:

if  num1 == num2 == 100:
print(10000)

elif  max1 < 100:
if  len(str(res2)) == 2:
res2 = str(res2)[-2:]
print2(res1, res2)

else:
check_len(res1,res2)

elif min1 > 100:
if  len(str(res2)) == 2:
print1(res1, res2)

else:
check_len(res1,res2)

else :
res1 = max1 - 100
res2 = min1 - 100
res3 = (min1 + res1) * 100
res4 = res1*res2
print(f"""
Step 1 : {max(num1, num2)} - {100} = {res1}
Step 2 : ({num2} + {res1}) + 00 = {res3}
Step 3 : {res1} x {res2} = {res4}
Total
{res3}+({res4}) = {res3+res4}
""")

else:
print("This trick won't work", num1, num2)
exit(0)

main(num1, num2)



Example 1: When the numbers are less than 100

This trick only works for range 10 to 199 included
Enter first number:56
Enter second number:67

Step 1 :
56 is -44 greater than 100
And
67 is -33 greater than 100
Hence,
The first 2 digits are 100+(-44)+(-33) = 23
The last digits are -44 * -33 = 1452

Total 3752

[Program finished]


Example 2: When greater than 100

This trick only works for range 10 to 199 included
Enter first number:110
Enter second number:120

Step 1 :
110 is 10 greater than 100
And
120 is 20 greater than 100
Hence,
The first 2 digits are 100+(10)+(20) = 130
The last digits are 10 * 20 = 200

Total 13200

[Program finished]


Example 3: One is smaller and one is greater than 100

This trick only works for range 10 to 199 included
Enter first number:126
Enter second number:98

Step 1 : 126 - 100 = 26
Step 2 : (98 + 26) + 00 = 12400
Step 3 : 26 x -2 = -52
Total
12400+(-52) = 12348

[Program finished]


We cannot change the output as kids might not understand technical jargon Although, I admit its not that well formatted. I tried my best. The purpose is for kids to check stepwise where they are wrong.

• I grew up in a generation where the essence was taught first. Any short-cuts were perhaps mentioned in passing and - if so - certainly afterwards. If the goal is to teach kids how to perform arithmetical computations quickly, just teach them how to install a calculator-app. I'm obviously biased, but if the goal is to teach kids arithmetic to get them started on the road of mathematics/logic in general, get the essence ingrained first, not the tricks. Jul 15, 2021 at 11:28
• in a competitive exam, you have to know trick, bcos calc not allowed. it's better if we teach them from start, rather than learning at later age Jul 15, 2021 at 13:23
• if num1 in cond and num2 in cond: - is this working? Jul 15, 2021 at 18:23
• refactored the code but forgot to do other necessary changes... sorry, correction done Jul 15, 2021 at 18:35
• @Subham: I question the validity of evaluating the question (solely) in the context of competitive exams, but even there "calcs" are allowed (you're allowed to calculate anything using the machinery of your brain). I can't imagine a (serious) competitive exam where employing a trick that work on a 200/∞ ᵗʰ of all integers and (moreover) is computationally just as efficient as the real deal has merit. Jul 20, 2021 at 11:40

print("This trick only works for range 10 to 199 included")

num1 = int(input("Enter 1st no.:"))
num2 = int(input("Enter 2nd no.:"))

max1 = max(num1, num2)
min1 = min(num1, num2 )

COND = (min1 > 9) and (max1 < 200)

def print2(res1, res2):
res3 = num1+num2-100
res4 = (num1-100) * (num2 -100)
print(f"""
Step 1 :
{num1} is {num1-100} greater than 100
And
{num2} is {num2-100} greater than 100
Hence,
The first 2 digits are 100+({num1-100})+({num2-100}) = {res3}
The last digits are {num1-100} * {num2 -100} = {res4}

Total {res1}{res2}
""")
def print1(res1, res2):
print(f"""
Step 1 :
{num1} is {num1-100} greater than 100
And
{num2} is {num2-100} greater than 100
Hence,
The first 3 digits are 100+({num1-100})+({num2-100}) = {res1}
The last 2 digits are {num1-100} * {num2 -100} = {res2}
Total {res1}{res2}
""")

def check_len(res1, res2):
if len(str(res2)) < 2:
res2 = str(0)+str(res2)
print1(res1, res2)

elif len(str(res2)) > 2:
res1 = res1 + int(str(res2)[:-2])
res2 = str(res2)[-2:]
print2(res1, res2)

def main(num1, num2):
res1 = num1 + num2 - 100
res2 = (num1-100)*(num2-100)

if not COND:
print("This trick won't work", num1, num2)
return

if  num1 == 100 and num2 == 100:
print(10000)
return

if  max1 < 100:
if  len(str(res2)) == 2:
res2 = str(res2)[-2:]
print2(res1, res2)
return
check_len(res1,res2)
return

if min1 > 100:
if  len(str(res2)) == 2:
print1(res1, res2)
return
check_len(res1,res2)
return

res1 = max1 - 100
res2 = min1 - 100
res3 = (min1 + res1) * 100
res4 = res1 * res2
print(f"""
Step 1 : {max(num1, num2)} - {100} = {res1}
Step 2 : ({num2} + {res1}) + 00 = {res3}
Step 3 : {res1} x {res2} = {res4}
Total
{res3}+({res4}) = {res3+res4}
""")

main(num1, num2)

$$$$
`