Wednesday, 27 January 2021

Integer addition and product

 Question) Given a two integer numbers return their product and  if the product is greater than 1000, then return their sum

case 1:

Number 1 = 40

Number 2 = 89

output: 129


case 2:

Number 1 = 500

Number 2 = 200

output: 700


Code:


no_1 = int(input('Enter no_1'))
no_2 = int(input('Enter no_2'))

if (no_2*no_1) >= 1000:
print(no_1+no_2)
else:
print(no_2*no_1)

Post Top Ad

Your Ad Spot

Pages

SoraTemplates

Best Free and Premium Blogger Templates Provider.

Buy This Template