-
Notifications
You must be signed in to change notification settings - Fork 1
/
Structure.c
41 lines (38 loc) · 1.16 KB
/
Structure.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#include<stdio.h>
struct date
{
int dd;
int mm;
int yy;
};
struct product
{
int number;
int price;
struct date dt;
};
void main(){
struct product p[5];
int i;
printf("\n Enter the details of 3 products\n");
for(i=0;i<3;i++)
{
printf("\n PRODUCT %d DETAILS\n",i+1);
printf("\n Enter the product number");
scanf("%d",&p[i].number);
printf("\n Enter the price of the product");
scanf("%d",&p[i].price);
printf("\n Enter the date of purchase in DD - MM -YY format \n");
printf("\n Enter the day of purchase\n");
scanf("%d",&p[i].dt.dd);
printf("\n Enter the month of purchase");
scanf("%d",&p[i].dt.mm);
printf("\n Enter the year of purchase\n");
scanf("%d",&p[i].dt.yy);
}
printf("\n PRODUCT DETAILS\n");
printf("\n Number cost date\n");
for(i=0;i<3;i++){
printf("\n %d\t %d\t-%d-%d-%d\n",p[i].number,p[i].price,p[i].dt.dd,p[i].dt.mm,p[i].dt.yy);
}
}