Logo 
Search:

C Programming Articles

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

Program to print inventory report that counts total based on quantity and rate of items

Posted By: Cedric Sanders     Category: C Programming     Views: 9969

Program to print inventory report that counts total based on quantity and rate of items.

Code for Program to print inventory report that counts total based on quantity and rate of items in C Programming

void main()
{
    int i,quantity[5];
    float rate[5],value,totalvalue;
    char code[5][5];
    clrscr();

    i=1;
    while(i <= ITEMS)
    {
        printf("Enter code,quantity, and rate : ");
        scanf("%s %d %f",code[i],&quantity[i],&rate[i]);
        i++;
    }

    printf("\n\n");
    printf("                INVENTORY REPORT    \n");
    printf("---------------------------------------------------\n");
    printf("Code     Quantity          Rate           Vlaue   \n");
    printf("---------------------------------------------------\n");

    totalvalue =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);
        totalvalue +=value;
        i++;
    }
    printf("--------------------------------------------------\n");
    printf("                      Total Value = %e\n",totalvalue);
    printf("--------------------------------------------------\n");
    getch();
}
  
Share: 



Cedric Sanders
Cedric Sanders author of Program to print inventory report that counts total based on quantity and rate of items is from Philadelphia, United States.
 
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!