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
/
INVSALE.C
< prev
next >
Wrap
Text File
|
1979-12-31
|
768b
|
31 lines
main() /* Inventory & sales *
* example of types */
{
long total, stock;
unsigned sales;
float price, commission, cost, income;
double profit;
char type;
sales = 45678; /* item sold */
stock = 112502; /* items on hand */
price = 42.50; /* selling price */
cost = 19.95; /* cost of item */
type = 'A';
/* Calculate values */
total = stock - sales;
income = price * sales;
profit = (price - cost) * sales;
commission = profit * 0.03;
/* print answers */
printf("Total inventory = %ld of type %c\n",total, type);
printf("On sales of %u items: profit = %f\n",sales, profit);
printf("Commissions at a rate of 0.03 = %f\n",commission);
}