If cost price and selling price of an item is input through the keyboard, write a program to determine whether the seller 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 ( )
{
float cp, sp, p, l;
clrscr ( );
printf ("\n\n\n\t\t Enter cost price.........:"); scanf ("%f",&cp);
printf ("\n\n\t\t Enter selling price......:"); scanf ("%f",&sp);
p = sp - cp;
l = cp - sp;
if ( p > 0 )
{
printf ("\n\n\n\t\t The seller has made a profit of a profit of ...: Rs.%.2f", p);
}
if ( l > 0 )
{
printf ("\n\n\n\t\t The seller is in loss by .......: Rs.%.2f", l);
}
if ( p == 0)
{
printf ("\n\n\n\t\t There is no loss and no profit.");
}
getch ( );
}
Click here to contact us
#include <stdio.h>
#include <conio.h>
void main ( )
{
float cp, sp, p, l;
clrscr ( );
printf ("\n\n\n\t\t Enter cost price.........:"); scanf ("%f",&cp);
printf ("\n\n\t\t Enter selling price......:"); scanf ("%f",&sp);
p = sp - cp;
l = cp - sp;
if ( p > 0 )
{
printf ("\n\n\n\t\t The seller has made a profit of a profit of ...: Rs.%.2f", p);
}
if ( l > 0 )
{
printf ("\n\n\n\t\t The seller is in loss by .......: Rs.%.2f", l);
}
if ( p == 0)
{
printf ("\n\n\n\t\t There is no loss and no profit.");
}
getch ( );
}
Click here to contact us
No comments:
Post a Comment