Code: Profit.C

void main()

{

int cp,sp,profit,loss;

clrscr();

printf("enter cost and selling price");

scanf("%d %d ",&cp,&sp);

if(sp>cp)

{

profit=sp-cp;

printf("Profit=%d",profit);

}

else

{

loss=cp-sp;

printf("loss=%d",loss);

}

getch();

}

output:

\enter cost and selling price

1000 1200

profit= 200

\enter cost and selling price

1500 1200

loss= 300