#include
#include
void main()
{
float cp,sp,diff;
clrscr();
printf("Enter cost price of item Rs. ");
scanf("%f",&cp);
printf("\nEnter selling price of item Rs. ");
scanf("%f",&sp);
if(sp>cp)
{
diff = sp - cp;
printf("\nYou incurred profit of Rs.%0.2f",diff);
}
else
{
diff = cp - sp;
printf("\nYou incurred loss of Rs.%0.2f",diff);
}
getch();
}
#include
void main()
{
float cp,sp,diff;
clrscr();
printf("Enter cost price of item Rs. ");
scanf("%f",&cp);
printf("\nEnter selling price of item Rs. ");
scanf("%f",&sp);
if(sp>cp)
{
diff = sp - cp;
printf("\nYou incurred profit of Rs.%0.2f",diff);
}
else
{
diff = cp - sp;
printf("\nYou incurred loss of Rs.%0.2f",diff);
}
getch();
}
0 Comments