#include <stdio.h>
#include <conio.h>
main()
{
int cp,sp,total;
clrscr();
printf("\n enter cost price ");
scanf("\n %d",&cp);
printf("\n enter selling price");
scanf("\n %d",&sp);
total=sp-cp;
total=cp-sp;
if(total>0)
{
printf("\n total profit =%d",total);
}
else
{
if(total<0)
{
printf("\n total Loss =%d",total);
}
else
{
printf("\n neither total loss nor total profit");
}
}
return(0);
}
output:-
enter the cost price (cp) =100
enter the sell price (sp) =200
total profit =100