|Profit or Loss program in c| | calculate profit or loss in c|
C program to find profit and loss
code:
#include<stdio.h>
int main()
{
int cp,sp,profit,loss;
printf("enter the cost
price:");
scanf("%d",&cp);
printf("enter the selling
price:");
scanf("%d",&sp);
if(sp<cp)
{
/*loss*/
loss=cp-sp;
printf("loss %d",loss);
}
else
{
/*profit*/
profit=sp-cp;
printf("profit
%d",profit);
}
return 0;
}
Comments
Post a Comment