PROGRAM TO FIND PROFIT & LOSS

C, C++, etc Programing examples. Post as many you can. Test the programs and discuss about the output of the programes.
Forum rules
Please Discuss & post only about the programes and its Output

PROGRAM TO FIND PROFIT & LOSS

Postby charulatha » Tue Apr 13, 2010 2:30 pm

/* PROFIT AND LOSS */

#include<stdio.h>
#include<conio.h>
main()
{
float cp,sp,pro,los;
printf("Enter the cost price and selling price of the item\n");
scanf("%f%f",&cp,&sp);
pro=sp-cp;
los=cp-sp;
if(pro>0)
printf("Profit=Rs.%.2f\n",pro);
else if(los>0)
printf("Loss=Rs.%.2f\n",los);
else if(pro==0 && los==0)
printf("Profit=Rs.%.2f and loss=Rs.%.2f\n",pro,los);
getch();
}
Regards,
Charulatha.
User avatar
charulatha
Moderator
 
Posts: 669
Joined: Sat Oct 17, 2009 2:54 pm
membership: Senior Technician of The Institution of Engineers (India)- ST

ad
 

Return to Computer Notes : Some Sample Programs

Who is online

Users browsing this forum: No registered users and 0 guests