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;
}

Md Amir Hamzah

Md. Amir Hamzah is an overthinker by mind and a writer by heart! Along with pursuing his BSC in CSE, he is always on the verge to try something new with each sunrise in the tech and social world! Come join him in the journey and find answers to your queries! Right now I am working on The Tech Breach website www.thetechbreach.com/

Leave a Reply

Your email address will not be published. Required fields are marked *