home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
MBUG
/
MBUG150.ARC
/
C-STUFF2.LBR
/
INVSALE1.C
< prev
next >
Wrap
Text File
|
1979-12-31
|
1KB
|
40 lines
#include "stdio"
main()
{
long total, stock, sales;
float price, commision, cost, income;
double profit;
char type;
/* input values to be used */
printf("Enter the following items to calculate the gross profit\n");
printf("net profit, and sales commision of an item.\n");
printf("Enter the item type (1 char): ");
scanf("%c",&type);
printf("Enter number of the items sold: ");
scanf("%d",&sales);
printf("Enter number of the items on hand: ");
scanf("%d",&stock);
printf("Enter the item's selling price: ");
scanf("%f",&price);
printf("Enter the cost of the item: ");
scanf("%f",&cost);
/* calculate */
total = stock - sales;
income = price * sales;
profit = (price - cost) * sales;
commision = profit * 0.03;
/* print output */
printf("End of month total inventory = %ld of type %c\n", total, type);
printf("On a gross income of %6.2f profit = %6.2f\n", income, profit);
printf("Commisions at a rate of 0.03 = %6.2f\n", commision);
}