Thursday, 19 July 2018

Profit or Loss?

===========================================================================
                                CODING



#include<iostream.h>
#include<conio.h>

void main()
{
clrscr();
float cp,sp,p,l;
cout<<"\n Enter the Cost price: ";
cin>>cp;
cout<<"\n Enter the Selling Price: ";
cin>>sp;
if(sp>cp)
{p=sp-cp;
cout<<"\n You have made profit of "<<p<<"!!";}
else
{l=cp-sp;
cout<<"\n You have incurred loss of "<<l;}
getch();
}

===========================================================================


                                OUTPUT


No comments:

Post a Comment