Virajsinh

B_PRM_04

Oct 9th, 2017
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.94 KB | None | 0 0
  1. /* Write a program to read and display information of
  2. a student, using a structure within a structure. */
  3.  
  4. #include<stdio.h>
  5. #include<conio.h>
  6.  
  7.  
  8. struct dob
  9. {
  10.     int day,month,year;
  11. };
  12.  
  13. typedef struct info
  14. {
  15.     int roll;
  16.     char name[15], add[15], city[15];
  17.     struct dob date;
  18. }stud;
  19.  
  20.  
  21. void main()
  22. {
  23.     stud stud;
  24.     clrscr();
  25.  
  26.     printf("Using Strcut Within Structure");
  27.     printf("\nEnte Roll :");
  28.     scanf("%d", &stud.roll);
  29.     printf("Enter Name :");
  30.     scanf("%s",stud.name);
  31.     printf("Enter Address :");
  32.     scanf("%s",stud.add);
  33.     printf("Enter City :");
  34.     scanf("%s",stud.city);
  35.     printf("Enter Date Of Birth DD/MM/YYYY :");
  36.     scanf("%d/%d/%d",&stud.date.day, &stud.date.month, &stud.date.year);
  37.  
  38.     printf("\n Roll : %d",stud.roll);
  39.     printf("\n Name : %s",stud.name);
  40.     printf("\n Address : %s",stud.add);
  41.     printf("\n City : %s",stud.city);
  42.     printf("\n Date Of Birth : %d/%d/%d",stud.date.day, stud.date.month, stud.date.year);
  43.     getch();
  44. }
Add Comment
Please, Sign In to add comment