I have used Code::blocks 12 compiler for debugging purpose. But you can use any C programming language compiler as per your availability.
#include <stdio.h> struct student{ char name[30]; int rollNo; struct dateOfBirth{ int dd; int mm; int yy; }DOB; }; int main() { struct student std; printf("Enter name: "); gets(std.name); printf("Enter roll number: "); scanf("%d",&std.rollNo); printf("Enter Date of Birth [DD MM YYYY] format: "); scanf("%d%d%d",&std.DOB.dd,&std.DOB.mm,&std.DOB.yy); printf("\nName : %s \nRollNo : %d \nDate of birth : %02d - %02d - %02d\n",std.name,std.rollNo,std.DOB.dd,std.DOB.mm,std.DOB.yy); return 0; }
Enter name: John
Enter roll name: 52
Enter Date of Birth [DD MM YYYY] format: 18 10 1990
Name : John
RollNo : 52
Date of birth : 18 - 10 - 1990
total answers (1)
start bookmarking useful questions and collections and save it into your own study-lists, login now to start creating your own collections.
I have used Code::blocks 12 compiler for debugging purpose. But you can use any C programming language compiler as per your availability.
Result:
Enter name: John
Enter roll name: 52
Enter Date of Birth [DD MM YYYY] format: 18 10 1990
Name : John
RollNo : 52
Date of birth : 18 - 10 - 1990
need an explanation for this answer? contact us directly to get an explanation for this answer