Check profit or loss
CODE
Check profit or loss
Input purchase price (pp) and sale price(sp) and find out profit or
loss with amount
//pr=sp-pp
//lo=pp-sp
int main()
{
float
pr,lo,sp,pp;
printf("\n enter the purchase price and selling price:");
scanf("%f%f",&pp,&sp);
if(sp>pp)
{
pr=sp-pp;
printf("\n profit=%f",pr);
}
else
{
lo=pp-sp;
printf("\n loss=%f",lo);
}
}
Output:
enter the purchase price and selling price:
34
65
profit=31.000000
Check profit or loss
Reviewed by Unknown
on
December 14, 2018
Rating:
No comments:
If you have any doubt or query ,comment below: