home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / mbug / mbug150.arc / C-STUFF2.LBR / INVSALE2.C < prev    next >
Text File  |  1979-12-31  |  1KB  |  41 lines

  1.  
  2. #include "stdio"
  3. #define  PERCENT 0.03
  4.  
  5. main()
  6.  
  7.     {
  8.     long total, stock, sales;
  9.     float price, commision, cost, income;
  10.     double profit;
  11.     char type;
  12.  
  13.     /* input values to be used */
  14.  
  15.     printf("Enter the following items to calculate the gross profit\n");
  16.     printf("net profit, and sales commision of an item.\n");
  17.     printf("Enter the item type (1 char): ");
  18.     scanf("%c",&type);
  19.     printf("Enter number of the items sold: ");
  20.     scanf("%d",&sales);
  21.     printf("Enter number of the items on hand: ");
  22.     scanf("%d",&stock);
  23.     printf("Enter the item's selling price: ");
  24.     scanf("%f",&price);
  25.     printf("Enter the cost of the item: ");
  26.     scanf("%f",&cost);
  27.  
  28.     /* calculate */
  29.  
  30.     total = stock - sales;
  31.     income = price * sales;
  32.     profit = (price - cost) * sales;
  33.     commision = profit * PERCENT;
  34.  
  35.     /* print output */
  36.  
  37.     printf("End of month total inventory = %ld of type %c\n", total, type);
  38.     printf("On a gross income of %6.2f profit = %6.2f\n", income, profit);
  39.     printf("Commisions at a rate of %f = %f\n", PERCENT, commision);
  40.     }
  41.