C Programming Code Examples C > Miscellaneous Code Examples C Program to Display the Inventory of Items in a Store C Program to Display the Inventory of Items in a Store This C Program display the inventory of items in a store. The program accepts the value of item name, item code, price, quantity & manufacture date. Then display those value in a structured way. #include <stdio.h> void main() { struct date { int day; int month; int year; }; struct details { char name[20]; int price; int code; int qty; struct date mfg; }; struct details item[50]; int n, j; printf("Enter number of items:"); scanf("%d", &n); fflush(stdin); for (j = 0; j < n; j++) { fflush(stdin); printf("Item name: \n"); scanf("%s", item[j].name); fflush(stdin); printf("Item code: \n"); scanf("%d", &item[j].code); fflush(stdin); printf("Quantity: \n"); scanf("%d", &item[j].qty); fflush(stdin); printf("price: \n"); scanf("%d", &item[j].price); fflush(stdin); printf("Manufacturing date(dd-mm-yyyy): \n"); scanf("%d-%d-%d", &item[j].mfg.day, &item[j].mfg.month, &item[j].mfg.year); } printf(" ***** INVENTORY ***** \n"); printf("--------------------------------------------------------- ---------\n"); printf("S.N.| NAME | CODE | QUANTITY | PRICE | MFG.DATE \n"); printf("--------------------------------------------------------- ---------\n"); for (j = 0; j < n; j++) printf("%d %-15s %-d %-5d %-5d %d/%d/%d \n", j + 1, item[j].name, item[j].code, item[j].qty, item[j].price, item[j].mfg.day, item[j].mfg.month, item[j].mfg.year); printf("--------------------------------------------------------- ---------\n"); }