Sunday, July 09, 2006

Profit and Loss using if else

If cost price and selling price of an item is input through the keyboard,
write a program to determine whether the seller has made profit or incurred loss.
Also determine how much profit he made or loss he incurred.


int cp,sp,profitloss;

printf ("Enter the cost price and selling price of the item: ");

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


if (sp>cp)

else if (cp>sp)
printf ("Loss=%d",profitloss);

else if(sp==cp)

printf ("No profit no loss");

The file can be downloaded at:
Download File

1 comment: