#include <stdio.h>
#include <conio.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,i;
clrscr();
printf(“Enter number of items:”);
scanf(“%d”,&n);
fflush(stdin);
for(i=0;i<n;i++)
{
fflush(stdin);
printf(“Item name:”);
scanf(“%[^\n]“,item[i].name);
fflush(stdin);
printf(“Item code:”);
scanf(“%d”,&item[i].code);
fflush(stdin);
printf(“Quantity:”);
scanf(“%d”,&item[i].qty);
fflush(stdin);
printf(“price:”);
scanf(“%d”,&item[i].price);
fflush(stdin);
printf(“Manufacturing date(dd-mm-yyyy):”);
scanf(“%d-%d-%d”,&item[i].mfg.day,&item[i].mfg.month,&item[i].mfg.year);
}
printf(“ ***** INVENTORY *****\n”);
printf(“——————————————————————\n”);
printf(“S.N.| NAME | CODE | QUANTITY | PRICE |MFG.DATE\n”);
printf(“——————————————————————\n”);
for(i=0;i<n;i++)
printf(“%d %-15s %-d %-5d %-5d %d/%d/%d\n”,i+1,item[i].name,item[i].code,item[i].qty,item[i].price,
item[i].mfg.day,item[i].mfg.month,item[i].mfg.year);
printf(“——————————————————————\n”);
getch();
}
/*——————————————————
Enter number of items:5
Item name:Tea Powder
Item code:123
Quantity:23
price:40
Manufacturing date(dd-mm-yyyy):12-03-2007
Item name:Milk Powder
Item code:345
Quantity:20
price:80
Manufacturing date(dd-mm-yyyy):30-03-2007
Item name:Soap Powder
Item code:510
Quantity:10
price:30
Manufacturing date(dd-mm-yyyy):01-04-2007
Item name:Washing Soap
Item code:890
Quantity:25
price:12
Manufacturing date(dd-mm-yyyy):10-03-2007
Item name:Shampoo
Item code:777
Quantity:8
price:50
Manufacturing date(dd-mm-yyyy):17-05-2007
***** INVENTORY *****
————————————————————————
S.N.| NAME | CODE | QUANTITY | PRICE |MFG.DATE
————————————————————————
1 Tea Powder 123 23 40 12/3/2007
2 Milk Powder 345 20 80 30/3/2007
3 Soap Powder 510 10 30 1/4/2007
4 Washing Soap 890 25 12 10/3/2007
5 Shampoo 777 8 50 17/5/2007
————————————————————————
——————————————————————–*/
Not Satisfied ? Just search & get the result
Related posts:
- C Program to accept N integer number and store them in an array AR. The odd elements in the AR are copied into OAR and other elements are copied into EAR. Display the contents of OAR and EAR
- C program to input N numbers (integers or reals) and store them in an array. Conduct a linear search for a given key number and report success or failure in the form of a suitable message
- C program to read N integers and store them in an array A, and so find the sum of all these elements using pointer. Output the given array and and the computed sum with suitable heading
- C program to read N names, store them in the form of an array and sort them in alphabetical order. Output the give names and the sorted names in two columns side by side with suitable heading
- C program to read N integers (zero, +ve and -ve) into an array A and to a) Find the sum of negative numbers b) Find the sum of positive numbers and c) Find the average of all input numbers Output the various results computed with proper headings
