Programming Examples

Python program to check where is profit or loss


Write a python program to input cost price, selling price of product from user and check whether is profit or loss and also print the Profit/loss amount

Solution

cp=float(input("Enter the Cost Price : "));
sp=float(input("Enter the Selling Price : "));
if cp==sp:
    print("No Profit No Loss")
else:
    if sp>cp:
        print("Profit of ",sp-cp)
    else:
        print("Loss of ",cp-sp)
Output

Enter the Cost Price : 300

Enter the Selling Price : 450

Profit of  150.0

>>> 

========================= 

Enter the Cost Price : 500

Enter the Selling Price : 379

Loss of  121.0

>>> 

========================= 

Enter the Cost Price : 400

Enter the Selling Price : 400

No Profit No Loss

CCC Online Test 2021 CCC Practice Test Hindi Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Best Java Training Institute in Prayagraj (Allahabad) Best Python Training Institute in Prayagraj (Allahabad) O Level Online Test in Hindi Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Sarkari Naukari Notification Best Website and Software Company in Allahabad Sarkari Exam Quiz