ASSIGNMENT PROGRAMING
Create a structure named date that has day,
month and year as its members. Include this
structure as a member in another structure
named employee which has name, id and
salary as other members. Use this structure
to read and display employee’s name, id,
date of birthday and salary.
#include <stdio.h>
struct employee{
char name[30];
int empId;
float salary;
};
struct date{
int day;
int month;
int year;
};
int main()
{
struct employee emp;
printf("\nEnter details :\n");
printf("Name ?: "); gets(emp.name);
printf("ID ?:"); scanf("%d",&emp.empId);
printf("Salary ?:"); scanf("%f",&emp.salary);
struct date t;
printf("\nEnter the date::"); scanf(" %d",&t.day);
printf("\nEnter the month ::"); scanf(" %d",&t.month);
printf("\nEnter the year::"); scanf(" %d",&t.year);
printf("\nEntered detail is:");
printf("\nName: %s" ,emp.name);
printf("\nId: %d" ,emp.empId);
printf("\nSalary: %f\n",emp.salary);
printf("Day %d month %d Year %d",t.day,t.month,t.year);
return 0;
}