Example:-
#include<stdio.h> #include<conio.h> struct dob { int day; char month[10]; int year; }d; struct student { int no; char name[10]; struct dob d; }std; void main() { struct student std; clrscr(); printf("Enter student no: "); scanf("%d",&std.no); printf("Enter student name: "); scanf("%s",&std.name); printf("Enter day value: "); scanf("%d",&std.d.day); printf("Enter month name: "); scanf("%s",&std.d.month); printf("Enter year value: "); scanf("%d",&std.d.year); printf("\n\nStudent no=%d\n",std.no); printf("stuudent name=%s\n",std.name); printf("Date of Birth:%d-%s-%d", std.d.day,std.d.month, std.d.year); getch(); } |
Output:-
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------------------------------
Post a Comment