algorithm for Define structure to enter employee information like name, id, salary and date of joining. Use nested structure to get address of employee. WAP to read 10 records and display the details of employees.


       #include<stdio.h>

       struct Address
       {
              char HouseNo[25];
              char City[25];
              char PinCode[25];
       };

       struct Employee
       {
           int Id;
           char Name[25];
           float Salary;
           struct Address Add;
       };

       void main()
       {
              int i;
              struct Employee E;

              printf("\n\tEnter Employee Id : ");
              scanf("%d",&E.Id);

              printf("\n\tEnter Employee Name : ");
              scanf("%s",&E.Name);

              printf("\n\tEnter Employee Salary : ");
              scanf("%f",&E.Salary);

              printf("\n\tEnter Employee House No : ");
              scanf("%s",&E.Add.HouseNo);

              printf("\n\tEnter Employee City : ");
              scanf("%s",&E.Add.City);

              printf("\n\tEnter Employee House No : ");
              scanf("%s",&E.Add.PinCode);

              printf("\nDetails of Employees");
              printf("\n\tEmployee Id : %d",E.Id);
              printf("\n\tEmployee Name : %s",E.Name);
              printf("\n\tEmployee Salary : %f",E.Salary);
              printf("\n\tEmployee House No : %s",E.Add.HouseNo);
              printf("\n\tEmployee City : %s",E.Add.City);
              printf("\n\tEmployee House No : %s",E.Add.PinCode);

       }


   Output :

                     Enter Employee Id : 101
                     Enter Employee Name : Suresh
                     Enter Employee Salary : 45000
                     Enter Employee House No : 4598/D
                     Enter Employee City : Delhi
                     Enter Employee Pin Code : 110056

              Details of Employees
                     Employee Id : 101
                     Employee Name : Suresh
                     Employee Salary : 45000
                     Employee House No : 4598/D
                     Employee City : Delhi
                     Employee Pin Code : 110056

				

Are there any code examples left?
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source