Problem :- Write A C++ Program To Determine Whether The Seller Made Profit or Loss. Also Determine How Much Profit or Loss He Made
If cost price and selling price of an item is input through the keyboard, write a program to determine whether the seller has made profit or incurred loss. Also determine how much profit he made or loss he incurred.
Formula :-
If cost price and selling price of an item is input through the keyboard, write a program to determine whether the seller has made profit or incurred loss. Also determine how much profit he made or loss he incurred.
Formula :-
Loss = Cost price (C.P.) – Selling Price (S.P.)
Profit =Selling Price (S.P.)-Cost price (C.P.)
Profit or Loss is always calculated on the cost price. Marked price: This is the price marked as the selling price on an article, also known as the listed price
Solution :-
Output:-
Profit =Selling Price (S.P.)-Cost price (C.P.)
Profit or Loss is always calculated on the cost price. Marked price: This is the price marked as the selling price on an article, also known as the listed price
Solution :-
#include<iostream>
using namespace std;
int main()
{
float sp,cp,l,p;
while(1)
{
cout<<"\n\nEnter The Selling Price \n";
cin>>sp;
cout<<"Enter The Cost Price \n";
cin>>cp;
if(cp>sp)
{
l=cp-sp;
cout<<"\n\nLoss Is = "<<l;
}
else if(cp<sp)
{
p=sp-cp;
cout<<"\nProfit Is = "<<p;
}
else
{
cout<<"\nNo Profit No Loss\n";
}
}
return 0;
}
Output:-
0 Comments: