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)

No comments:

Post a Comment

Author Details

Hi, I'm Prashant — a full-time software engineer with a passion for automation, DevOps, and sharing what I learn. I started Py-Bucket to document my journey through tools like Docker, Kubernetes, Azure DevOps, and PowerShell scripting — and to help others navigate the same path. When I’m not coding or writing, I’m experimenting with side projects, exploring productivity hacks, or learning how to build passive income streams online. This blog is my sandbox — and you're welcome to explore it with me. Get in touch or follow me for future updates!

About Me

About the Author

Author

Hi, I'm Prashant — a full-time software engineer with a passion for automation, DevOps, and sharing what I learn. I started Py-Bucket to document my journey through tools like Docker, Kubernetes, Azure DevOps, and PowerShell scripting — and to help others navigate the same path.

When I’m not coding or writing, I’m experimenting with side projects, exploring productivity hacks, or learning how to build passive income streams online. This blog is my sandbox — and you're welcome to explore it with me.

Get in touch or follow me for future updates!