When selling price is less than cost price, then it is said to be profit else loss.
#include<stdio.h>
void main()
{
int CP, SP, pro, loss;
printf("Enter cost price and selling price of an object:");
scanf("%d %d", &CP, &SP);
if(SP>CP)
{
pro = SP-CP;
printf("\n Profit = Rs.%d", pro);
}
else
{
loss = CP-SP;
printf("\n Loss = Rs.%d", loss);
}
}
0 Comments