Logo 
Search:

C Programming Articles

Submit Article
Home » Articles » C Programming » Homework HelpRSS Feeds

Inventory report

Posted By: Liam Evans     Category: C Programming     Views: 4918

Program to display an inventory report.

Code for Inventory report in C Programming

#define ITEMS 4                                             
                                                               
   main()                                                      
   {  /* BEGIN */
int i, quantity[5]; float rate[5], value, total_value; char code[5][5]; /* READING VALUES */
i = 1; while ( i <= ITEMS) { printf("Enter code, quantity, and rate:"); scanf("%s %d %f", code[i], &quantity[i],&rate[i]); i++; } /*.......Printing of Table and Column Headings.......*/
printf("\n\n"); printf(" INVENTORY REPORT \n"); printf("-------------------------------------------\n"); printf(" Code Quantity Rate Value \n"); printf("-------------------------------------------\n"); /*.......Preparation of Inventory Position..........*/
total_value = 0; i = 1; while ( i <= ITEMS) { value = quantity[i] * rate[i]; printf("%5s %10d %10.2f %e\n",code[i],quantity[i], rate[i],value); total_value += value; i++; } /*.......Printing of End of Table..................*/
printf("---------------------------------------------\n"); printf(" Total Value = %e\n",total_value); printf("---------------------------------------------\n"); } /* END */
Output Enter code, quantity, and rate:F105 275 575.00 Enter code, quantity, and rate:H220 107 99.95 Enter code, quantity, and rate:I019 321 215.50 Enter code, quantity, and rate:M315 89 725.00 INVENTORY REPORT ----------------------------------------------- Code Quantity Rate Value ----------------------------------------------- F105 275 575.00 1.581250e+005 H220 107 99.95 1.069465e+004 I019 321 215.50 6.917550e+004 M315 89 725.00 6.452500e+004 ----------------------------------------------- Total Value = 3.025202e+005 -----------------------------------------------
  
Share: 


Didn't find what you were looking for? Find more on Inventory report Or get search suggestion and latest updates.

Liam Evans
Liam Evans author of Inventory report is from London, United Kingdom.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!