#include<stdio.h> struct dob { int date; char month[20]; int year; }; struct student { int rno; char name1[80]; char name2[80]; int fees; struct dob obj; } stud[100]; main() { int n,i; printf("Enter no. of students\n"); scanf("%d",&n); for(i=0;i<n;i++) { printf("Enter roll no. of student %d\n",i+1); scanf("%d",&stud[i].rno); printf("Enter fees\n"); scanf("%d",&stud[i].fees); printf("Enter first name of student %d\n",i+1); scanf("%s",stud[i].name1); printf("Enter last name of student %d\n",i+1); scanf("%s",stud[i].name2); printf("Enter dob of student %d\n",i+1); scanf("%d",&stud[i].obj.date); scanf("%s",stud[i].obj.month); scanf("%d",&stud[i].obj.year); } for(i=0;i<n;i++) { printf("\n\n"); printf("Information of student %d\n",i+1); printf("Roll no. = %d\n",stud[i].rno); printf("Name = %s %s\n",stud[i].name1,stud[i].name2); printf("Fees = %d\n",stud[i].fees); printf("DOB = %d/%s/%d",stud[i].obj.date,stud[i].obj.month,stud[i].obj.year); } }
Output: