Sunday, October 3, 2010

write a program to accept the selling price form user whether the seller has made profit or incurred loss. also determine how much profit he made or loss he incurred

#include
#include
void main()
{
float cp,sp,p,l;// cp=cost price,sp=seller price, p=profit,l=loss

clrscr();
printf("Enter cost price\t:\t");
scanf("%f",&cp);
printf("Enter cost selling price\t:\t ");
scanf("%f",&sp);
p=sp-cp;
l=cp-sp;
if(p>0)
printf("The seller has made a profit of Rs.%.2f",p);
if(l>0)
printf("The seller is in loss by Rs.%.2f",l);

getch();
}

No comments: