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 Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online Exam Quiz O Level NIELIT Study material and Quiz Bank SSC Railway TET UPTET Question Bank career counselling in allahabad Best Website and Software Company in Allahabad Website development Company in Allahabad