PROFIT OR LOSS IN C++
#include <iostream>
using namespace std;
int main ()
{
float cPrice, sPrice, profit, loss;
cout<<"PLEASE ENTER COST PRICE : ";
cin>>cPrice;
cout<<"PLEASE ENTER SELLING PRICE : ";
cin>>sPrice;
if (sPrice>cPrice)
{
profit = sPrice - cPrice;
cout<<"THE PROFIT IS : "<<profit<<" TAKA"<<endl;
}
else
{
loss = cPrice - sPrice;
cout<<"THE LOSS IS : "<<loss<<" TAKA"<<endl;
}
return 0;
}
using namespace std;
int main ()
{
float cPrice, sPrice, profit, loss;
cout<<"PLEASE ENTER COST PRICE : ";
cin>>cPrice;
cout<<"PLEASE ENTER SELLING PRICE : ";
cin>>sPrice;
if (sPrice>cPrice)
{
profit = sPrice - cPrice;
cout<<"THE PROFIT IS : "<<profit<<" TAKA"<<endl;
}
else
{
loss = cPrice - sPrice;
cout<<"THE LOSS IS : "<<loss<<" TAKA"<<endl;
}
return 0;
}
OUTPUT
No comments