23. Display name,salary,conatct no, mail id of employee using union.


Comments

  1. Vaishnavi Kulkarni4:25 PM

    #include

    void main()
    {

    union emp
    {
    char name[10];
    float sal;
    int mi;
    int cno;

    }e;

    printf("Enter the name of employee=");
    scanf("%s",e.name);

    printf("\nEnter the salary of employee=");
    scanf("%f",& e.sal);

    printf("\nEnter the mail id of employee=");
    scanf("%d",& e.mi);

    printf("\nEnter the contact number of employee=");
    scanf("%d",& e.cno);

    printf("\nName=%s",e.name);
    printf(" \nContactNo=%d",e.cno);
    printf(" \nSalary=%f",e.sal);
    printf(" \nMailID=%d",e.mi);



    }

    ReplyDelete
    Replies
    1. Mubin Pirjade10:24 AM

      is it works,because in union we can access one member at a time.check it out!!!

      Delete
  2. #include

    void main()
    {

    union emp
    {
    char name[10];
    float sal;
    int mi;
    int cno;

    }e;

    printf("Enter the name of employee=");
    scanf("%s",e.name);

    printf("\nEnter the salary of employee=");
    scanf("%f",& e.sal);

    printf("\nEnter the mail id of employee=");
    scanf("%d",& e.mi);

    printf("\nEnter the contact number of employee=");
    scanf("%d",& e.cno);

    printf("\nName=%s,Cno=%d,Sal=%f,MailID=%d",e.name,e.Cno,e.sal,e.Mi);
    printf(" \nMailID=%d",e.mi);



    }

    ReplyDelete
  3. #include

    void main()
    {

    union emp
    {
    char name[10];
    float sal;
    int mi;
    int cno;

    }e;

    printf("Enter the name of employee=");
    scanf("%s",e.name);

    printf("\nEnter the salary of employee=");
    scanf("%f",& e.sal);

    printf("\nEnter the mail id of employee=");
    scanf("%d",& e.mi);

    printf("\nEnter the contact number of employee=");
    scanf("%d",& e.cno);

    printf("\nName=%s",e.name);
    printf(" \nContactNo=%d",e.cno);
    printf(" \nSalary=%f",e.sal);
    printf(" \nMailID=%d",e.mi);



    }

    ReplyDelete
  4. /*Display name,salary,conatct no, mail id of employee using union/*

    #include

    void main()
    {

    union employee
    {
    char name[10];
    float salary;
    int id;
    int no;

    }e;

    printf("Enter the name of employee...");
    scanf("%s",e.name);

    printf("\nEnter the salary of employee=");
    scanf("%f",& e.salary);

    printf("\nEnter the mail id of employee=");
    scanf("%d",& e.id);

    printf("\nEnter the contact number of employee=");
    scanf("%d",& e.no);

    printf(" \t\nNAME=%s",e.name);
    printf(" \t\nCONTACT NUMBER=%d",e.no);
    printf(" \t\nSALARY=%f",e.salary);
    printf(" \t\nE-MAIL ID=%d",e.id);



    }

    ReplyDelete
  5. #include
    void main()
    {
    union Emp
    {
    char name[30];
    char eid[30];
    int mno;
    float salary;
    }e;

    printf("\nEnter the name ,Mail_id,Mobile _no,salary\n");

    scanf("%s%s%d%f",e.name,e.eid,&e.mno,&e.salary);



    printf("\nInformation of Emp:\n");

    printf("\nName=%s\nMail_id=%s\nMobile_no=%d\nSalary=%f\n",e.name,e.eid,e.mno,e.salary);

    }

    ReplyDelete
    Replies
    1. Pallavi Bagal5:24 PM

      #include
      void main()
      {
      union Emp
      {
      char name[30];
      char eid[30];
      int mno;
      float salary;
      }e;

      printf("\nEnter the name ,Mail_id,Mobile _no,salary\n");

      scanf("%s%s%d%f",e.name,e.eid,&e.mno,&e.salary);



      printf("\nInformation of Emp:\n");

      printf("\nName=%s\nMail_id=%s\nMobile_no=%d\nSalary=%f\n",e.name,e.eid,e.mno,e.salary);

      }

      Delete
    2. mayuri magar10:35 AM

      #include
      void main()
      {
      struct employee
      {
      char n[20],mail[20];
      int sal,contact;
      }e;
      printf("\n\tEnter name,contact no,salary and mail id of employee:\n\t");
      scanf("%s%d%d%s",e.n,&e.contact,&e.sal,e.mail);
      printf("\n\tEmployee Details are:\n\t1.NAME=%s \n\t2.CONTACT NO.=%d \n\t3.SALARY=%d \n\t4.MAIL ID=%s",e.n,e.contact,e.sal,e.mail);
      }

      Delete
  6. Waghmare Swati12:42 PM

    /*To display the name,contact no, email id & salary of employee by using union */
    #include
    void main()
    {
    union emp
    {
    char name[20],mail[20];
    float salary;
    int no;
    }e[10];
    int i;
    for(i=0;i<=9;i++)
    {
    printf("\n\tEnter the name of employee:");
    scanf("%s",e[i].name);
    printf("\n\tEnter the Salary of employee:");
    scanf("%f",&e[i].salary);
    printf("\n\tEnter the Contact no of employee:");
    scanf("%d",&e[i].no);
    printf("\n\tEnter the mail ID:");
    scanf("%s",e[i].mail);

    }

    for(i=0;i<=9;i++)
    {
    printf("\n\tName of Employee=%s\n\tSalary of Employee=%f\n\tContact no of Employee=%d\n\tMail Id of Employee=%s",e[i].name,e[i].salary,e[i].no,e[i].mail);
    }
    }

    ReplyDelete
  7. Radha Ghadge SE 231:01 PM

    #include
    void main()
    {
    union emp
    {
    int salary;
    int cno;
    char id[20];
    }x;
    printf("\n enter salary");
    scanf("%d",&x.salary);
    printf("\n salary=%d",x.salary);
    printf("\n enter contact no");
    scanf("%d",&x.cno);
    printf("\n contact no=%d",x.cno);
    printf("\n enter the id");
    scanf("%s",&x.id);
    printf("\n id=%s",x.id);
    }


    ReplyDelete
  8. sanjivani atakare4:49 PM

    #include
    void main()
    {
    union emp
    {
    char name[50];
    float salary;
    int id;
    int contactno;
    }u[10];
    int i;
    for(i=0;i<=9;i++)
    {
    printf("\n\tEnter the name of employee\n\t");
    scanf("%s",u[i].name);
    printf("\n\tEnter the salary of employee\n\t");
    scanf("%f",&u[i].salary);
    printf("\n\tEnter the id of employee\n\t");
    scanf("%d",&u[i].id);
    printf("\n\tEnter the contactno of employee");
    scanf("%d",&u[i].contactno);
    }
    for(i=0;i<=9;i++)
    {


    printf("\n\tEmployee Name=%s,Employee salary=%f,Employee id=%d,Contactno=%d",u[i].name,u[i].salary,u[i].id,u[i].contactno);
    }
    }

    ReplyDelete
  9. lengarepooja5:00 PM

    #include
    void main()
    {
    union emp
    {
    char name[20],mail[20];
    float salary;
    int mno;
    }e;
    printf("\nEnter the name of employee,salary,contact no,mail ID of employee:");
    scanf("%s%f%d%s",e.name,&e.salary,&e.mno,e.mail);
    printf("\nInformation of Employee:\n");
    printf("\nName of Employee:%s\nSalary of employee:%f\nContact no of employee:%d\nMail Id Of employee:%s\n",e.name,e.salary,e.mno,e.mail);
    }

    ReplyDelete
  10. Sayali Daunde11:05 AM

    #include
    void main()
    {
    union Emp
    {
    char name[30];
    char eid[30];
    int mno;
    float salary;
    }e;

    printf("\nEnter the name ,Mail_id,Mobile _no,salary\n");

    scanf("%s%s%d%f",e.name,e.eid,&e.mno,&e.salary);



    printf("\nInformation of Emp:\n");

    printf("\nName=%s\nMail_id=%s\nMobile_no=%d\nSalary=%f\n",e.name,e.eid,e.mno,e.salary);

    }

    ReplyDelete
  11. Mubin Pirjade11:52 AM

    it's here only!!
    #include
    #include



    int main()
    {
    union book
    {
    char name[20];
    int pages;
    float price;
    };
    union book b1;

    printf("\n\tStudent information");
    strcpy(b1.name,"letusc");
    printf("\n\tName :%s",b1.name);

    b1.pages=800; b1.pages=800;
    printf("\n\tpages :%d",b1.pages);

    b1.price=123.45;
    printf("\n\tprice :%f",b1.price);

    return(0);
    }

    ReplyDelete
  12. sushma jadhav12:08 PM

    //Employee strcture
    #include
    void main()
    {

    union employee
    {
    char name[10],mailid[10];
    float salary;
    int conatctno;
    }e;

    int i;
    printf("Enter name\n salary \nconatctno\nmailid");
    scanf("\n%s\n%f\n%d\n%s",e.name,&e.salary,&e.conatctno,e.mailid);
    printf("nane=%s\nsalary=%f\nconatctno=%d\nmailid=%s",e.name,e.salary,e.conatctno,e.mailid);

    }

    ReplyDelete
  13. Dipali Kore12:13 PM

    //display information of emplyoee using union
    #include
    void main()
    {
    union emp
    {
    int salary;
    int mbno;
    char name[10];
    char id[10];
    }b;
    printf("\n enter the employee name=");
    scanf("%s",b.name);
    printf("\n enter contact no of employee=");
    scanf("%d",&b.mbno);
    printf("\n enter the salary of employee=");
    scanf("%d",&b.salary);
    printf("\n enter email id of employee=");
    scanf("%s",b.id);

    printf("\n%s%d%d%s",b.name,b.mbno,b.salary,b.id);
    }

    ReplyDelete
  14. #include
    void main()
    {
    union employee
    {
    char name[20],mail[20];
    int salary,contact;
    }p;
    printf("\nEmployee name=");
    scanf("%s",p.name);
    printf("\n\t\tname of Employee=%s",p.name);
    printf("\nsalary=");
    scanf("%d",&p.salary);
    printf("\n\t\tsalary=%d",p.salary);
    printf("\ncontact no=");
    scanf("%d",&p.contact);
    printf("\n\t\tcontact no=%d",p.contact);
    printf("\nenter mail ID=");
    scanf("%s",p.mail);
    printf("\n\t\tEmail ID=%s\n",p.mail);
    }

    ReplyDelete
  15. // details of empolyer by using union
    #include
    void main()
    {
    union emp
    {
    char name[10];
    float salary;
    char mid[30];
    int contact;
    }p;
    printf(" Enter the name of employee=");
    scanf("%s",p.name);
    printf("\n Name of employer=%s \n",p.name);
    printf("\n Enter the salary of employee=");
    scanf("%f",& p.salary);
    printf(" \n Salary of employer=%f \n",p.salary);
    printf("\n Enter the mail id of employee=");
    scanf("%s", p.mid);
    printf(" \n Mail ID of employee=%s \n",p.mid);
    printf("\n Enter the contact number of employee=");
    scanf("%d",& p.contact);
    printf(" \n Contact No of employer=%d \n",p.contact);
    }

    ReplyDelete
  16. Bhosale Dhanashri SE312:31 PM

    //program of displaying union of employee



    #include

    void main()
    {
    union employee
    {
    char name[10];
    float salary;
    int number;
    char email[15];
    }b;

    printf("\n Enter the name of the employee\n");
    scanf("%s",b.name);

    printf("\n Enter the salary of the employee::\n");
    scanf("%f",&b.salary);

    printf("\n Enter the mobile no of the employee::\n");
    scanf("%d",&b.number);


    printf("\n Enter the Email ID of the employee::\n");
    scanf("%s",b.email);
    printf("\n The name of the employee::%s \n The salary of employee::%f ",b.name,b.salary);


    printf(" \n Mobile no of employee=%d \n\t Email ID ofemployee=%s" ,b.number,b.email );
    }




    ReplyDelete
  17. Pandhare Dipali12:34 PM

    #include
    void main()
    {
    struct Employee;
    {
    char name;
    float salary;
    int id;
    }e;
    printf("\n\t Enter the name of Employee");
    scanf("%s",e.name);
    printf("\n\t Enter the salary of the Employee");
    scanf("%f",&e.salary);
    printf("\n\t Enter the id of the Employee");
    scanf("%d",&e.id);
    printf("\n\t Employee name=%s \n\t Employee salary=%f \n\t Employee id=%d,e.name,e.salary,e.id");
    }

    ReplyDelete
  18. poonam pusavale8:46 AM

    /*display n,s,cn,id of emp using union*/
    #include
    void main()
    {
    union emp
    {
    char name[10];
    float salary;
    int contactnum;
    int id;
    }e;
    printf("\n\t enter name of emp");
    scanf("%s",e.name);
    printf("\n\t enter salary of emp");
    scanf("%f",&e.salary);
    printf("\n\t enter contactnum of emp");
    scanf("%d",&e.contactnum);
    printf("\n\t enter id of emp");
    scanf("%d",&e.id);
    printf("\n\tname=%s \n\tsalary=%f \n\tcontactnum=%d \n\tid=%d",e.name,e.salary,e.contactnum,e.id);
    }

    ReplyDelete
  19. sonali nagane9:21 AM

    #include
    void main()
    {
    union employee
    {
    char name[10],mailid[10];
    int contact,salary;
    }e;
    {
    printf("\n enter employee name,employee mail id,employee contact,employee salary");
    scanf("\n %s%s%d%d",e.name,e.mailid,&e.contact,&e.salary);
    printf("\employee name=%s,employee mail id=%s,employee contact=%d,employee salary=%d",e.name,e.mailid,e.contact,e.salary);
    }
    }

    ReplyDelete
  20. puja khandare9:25 AM

    #include
    void main()
    {

    union emp
    {
    char name[10];
    float sal;
    int mi;
    int cno;
    }e;
    printf("Enter the name of employee=");
    scanf("%s",e.name);

    printf("\nEnter the salary of employee=");
    scanf("%f",& e.sal);

    printf("\nEnter the mail id of employee=");
    scanf("%d",& e.mi);

    printf("\nEnter the contact number of employee=");
    scanf("%d",& e.cno);

    printf("\nName=%s",e.name);
    printf(" \nContactNo=%d",e.cno);
    printf(" \nSalary=%f",e.sal);
    printf(" \nMailID=%d",e.mi);
    }

    ReplyDelete
  21. Bhanvase Yashoda10:06 AM

    /*union of employee*/
    #include
    void main()
    {
    union employee
    {
    char name[10];
    int mno;
    int id;
    float salary;
    } e;

    printf("\n\t enter name");
    scanf("%s",e.name);
    printf("\n\t enter mno");
    scanf("%d",&e.mno);
    printf("\n\t enter id");
    scanf("%d",&e.id);
    printf("\n\t enter salary");
    scanf("%f",&e.salary);

    printf("name=%s,mno=%d,id=%d,salary=%f",e.name,e.mno,e.id,e.salary);
    }





    ReplyDelete
  22. madhuri pujari5:26 PM

    #include
    void main()
    {
    union Book
    {
    char name[10];
    float price;
    int pages;
    }b;
    int i;
    printf("\n\tEnter Name of Book\n\t");
    scanf("%s",b.name);
    printf("\n\tEnter price of Book\n\t");
    scanf("%f",&b.price);
    printf("\n\tEnter Pages of Book\n\t");
    scanf("%d",&b.pages);

    printf("\n\tBook Name=%s,\n\tBook Price=%f,\n\tBook pages=%d",b.name,b.price,b.pages);

    }

    ReplyDelete
  23. Ranjit kalubarme12:04 PM

    #include

    void main()
    {

    union emp
    {
    char name[10];
    float sal;
    int mi;
    int cno;

    }e;

    printf("Enter the name of employee=");
    scanf("%s",e.name);

    printf("\nEnter the salary of employee=");
    scanf("%f",& e.sal);

    printf("\nEnter the mail id of employee=");
    scanf("%d",& e.mi);

    printf("\nEnter the contact number of employee=");
    scanf("%d",& e.cno);

    printf("\nName=%s",e.name);
    printf(" \nContactNo=%d",e.cno);
    printf(" \nSalary=%f",e.sal);
    printf(" \nMailID=%d",e.mi);
    }

    ReplyDelete
  24. Awate Snehal11:03 AM

    #include
    void main()
    {
    union emp
    {
    char name[20];
    int salary;
    int mbno;
    char id[20];
    }e[10];
    int i;
    for(i=0;i<9;i++)
    {
    printf("\n enter name");
    scanf("%s",e[i].name);
    printf("\n enter salary");
    scanf("%d",&e[i].salary);
    printf("\n enter mbno");
    scanf("%d",&e[i].mbno);
    printf("\n enter id");
    scanf("%s",e[i].id);
    }
    for(i=0;i<9;i++)
    {
    printf("\n\t name=%s salary=%d mbno=%d id=%s",e[i].name,e[i].salary,e[i].mbno,e[i].id);
    }
    }

    ReplyDelete
  25. sachita jadhav12:03 PM

    /*union of employee*/
    #include
    void main()
    {
    union employee
    {
    char name[10];
    int mno;
    int id;
    float salary;
    } e;

    printf("\n\t enter name");
    scanf("%s",e.name);
    printf("\n\t enter mno");
    scanf("%d",&e.mno);
    printf("\n\t enter id");
    scanf("%d",&e.id);
    printf("\n\t enter salary");
    scanf("%f",&e.salary);

    printf("name=%s,mno=%d,id=%d,salary=%f",e.name,e.mno,e.id,e.salary);
    }





    ReplyDelete

Post a Comment