#include <iostream>
using namespace std;
int main() {
int cp;
cout<<"enter cost price "<<endl;
cin>>cp;
int sp;
cout<<"enter selling price"<<endl;
cin>>sp;
if(cp>sp) {
cout<<"loss = "<<cp-sp<<endl;
}
else if (cp<sp) { //here i can also use if statement only
cout<<"profit = "<<sp-cp<<endl;
}
if (cp==sp) {
cout<<"no profit no loss";
}
}
To embed this project on your website, copy the following code and paste it into your website's HTML: