Sunday, 15 May 2016

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

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

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

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

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

Extreme Recommended:- Like our Facebook Page or Join our Facebook Group and Google plus Community for up-to-date. If you have any Query or Question you can ask in the group, I will Try To Solve your Query and try to answers of your Questions withing 24 Hours, You can also Email me or comment below Please suggest to your Friends to join and like our page and don't forget to Subscribe. Enter your Email and click to subscribe.

Ghanendra Yadav

Ghanendra Yadav

Hello, I Am Ghanendra Yadav Owner of This Blog, I am professional Blogger and Programmer. I Love Programming, Logo Making, And Banner Designing. My Highest Qualification is MCA From NIT Warangal. You Can Find Me On Social Media Through Below Link And If You Have Any Query Related To Programming And Other Subject Comment Below or You Can Mail Me I Will Try To Answer Within 24 Hours Email:- yghanendra@student.nitw.ac.in

Find me on Social Media

Facebook | Twitter | Google+ | RSS Feed

No comments:

Post a Comment