Q:

C++ Program To Determine Whether The Seller Made Profit or Loss.

0

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 :-
 
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

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

#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:

Enter The Selling Price 

2500

Enter The Cost Price 

200

Profit Is = 2300

Enter The Selling Price 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

<< C++ Program To Check Date Validation (Valid Or Not...