[Solved] Lidiya purchased some gold a few years back, and now she has no other way to pay her medical bills without selling the gold

Lidiya purchased some gold a few years back, and now she has no other way to pay her medical bills without selling the gold. You can help Lidiya to know how much profit or loss she has to bear If she sold her gold today.

You are provided with the old price when she purchased the gold and the current price she will get in the market.

Constraints

Cost of gold is a positive integer i.e. >=10000

Sample Input 0

48000

56000

Sample Output 0

8000

Solution

Approach:

The input is taken in the variable n.

The input is taken in the variable m.

If the value of n is less than the value of m, then the difference between the two values is printed.

If the value of n is greater than the value of m, then the difference between the two values is printed.

n = int(input())

m = int(input())

if n < m:

    print(m-n)

else:

    print(n-m)

Happy Learning – If you require any further information, feel free to contact me.

Share your love
Saurav Hathi

Saurav Hathi

I'm currently studying Bachelor of Computer Science at Lovely Professional University in Punjab.

πŸ“Œ Nodejs and Android 😎
πŸ“Œ Java

Articles: 444

Leave a Reply

Your email address will not be published. Required fields are marked *