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

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