Skip to main content

WAP to enter cost price and selling price of an item & determine whether the seller has made profit or incurred loss. Also determine how much profit he made or loss he incurred.

 

#include<iostream.h>
#include<conio.h>
void main()
{
	int cp,sp,result;
	cout<<"Enter cost price of item : ";
	cin>>cp;
	cout<<"Enter selling price of item : ";
	cin>>sp;
	result=sp-cp;
	if(result>0)
		cout<<"Profit : "<<result;
	else
		if(result<0)
    			cout<<"Loss : "<<-(result);
		else
			cout<<"No profit no loss";
	getch();
}

Comments