Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Write a program to read and display information of
- a student, using a structure within a structure. */
- #include<stdio.h>
- #include<conio.h>
- struct dob
- {
- int day,month,year;
- };
- typedef struct info
- {
- int roll;
- char name[15], add[15], city[15];
- struct dob date;
- }stud;
- void main()
- {
- stud stud;
- clrscr();
- printf("Using Strcut Within Structure");
- printf("\nEnte Roll :");
- scanf("%d", &stud.roll);
- printf("Enter Name :");
- scanf("%s",stud.name);
- printf("Enter Address :");
- scanf("%s",stud.add);
- printf("Enter City :");
- scanf("%s",stud.city);
- printf("Enter Date Of Birth DD/MM/YYYY :");
- scanf("%d/%d/%d",&stud.date.day, &stud.date.month, &stud.date.year);
- printf("\n Roll : %d",stud.roll);
- printf("\n Name : %s",stud.name);
- printf("\n Address : %s",stud.add);
- printf("\n City : %s",stud.city);
- printf("\n Date Of Birth : %d/%d/%d",stud.date.day, stud.date.month, stud.date.year);
- getch();
- }
Add Comment
Please, Sign In to add comment