Program to determine whether a person has made profit or incurred loss. Also determine how much profit he made or loss he incurred.
Program to determine whether a person has made profit or incurred loss. Also determine how much profit he made or loss he incurred.
#include <stdio.h>
#include <conio.h>
void main()
{
int cp, sp, profit, loss;
printf ("Enter Selling Price and Cost Price");
scanf ("%d%d", &cp, &sp);
if ( cp > sp )
{
loss = cp - sp;
printf ("Loss is of %d", loss);
}
else
{
profit = sp - cp;
printf ("Profit is of %d", profit);
}
getch();
}