#include<stdio.h>
void main()
{
float sp,cp,proft,loss;
printf("Enter cost price=");
scanf("%f",&cp);
printf("\nEnter selling price=");
scanf("%f",&sp);
proft=sp-cp;
loss=cp-sp;
if(sp>cp)
{
printf("\n Profit=%f",proft);
}
else
{
printf("\n Loss=%f",loss);
}
}
The output will be