How to know whether it is profit or loss or nothing
CODE
How to know whether
it is profit or loss or nothing
Program to check profit, loss or nothing, and what is the amount
int main()
{
int sp,pp,a;
printf("\n enter the purchase price and selling price:");
scanf("%d%d",&pp,&sp);
a=sp-pp;
if (a<0)
printf("\n loss=%d",a*(-1));
else
if(a>0)
printf("\n profit=%d",a);
else
printf("\n neither profit nor loss");
}
Output:
enter the purchase price and selling price:
45
87
profit=42
How to know whether it is profit or loss or nothing
Reviewed by Unknown
on
December 15, 2018
Rating:
No comments:
If you have any doubt or query ,comment below: