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

Posted: August 26, 2012 in Uncategorized
#include <stdio.h>
#include <conio.h>
int main()
{
int cp,sp,total;
printf(" 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);
}
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s