Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<stdio.h>
- struct Employee
- {
- int Eno;//Eno for employee number
- char name[20];
- float salary;
- char DOJ[20]; //DOJ for date of join
- };
- int main(void)
- {
- struct Employee employees[5];
- for(int i = 0; i < 5; i++)
- {
- printf("Enter the name of the employee for employee no %d: ", i + 1);
- gets(employees[i].name);
- printf("Enter the salary: ");
- scanf("%f", &employees[i].salary);
- getchar();//to ignore the '\n' which you enter after entering the salary
- // '\n' may assign in the next string call so we have to ignore it
- printf("Enter the date of join: ");
- gets(employees[i].DOJ);
- }
- for(int i = 0; i < 5; i++)
- {
- if(employees[i].salary > 20000)
- {
- printf("Employee No: %d\n", i + 1);
- printf("Name: %s\n", employees[i].name);
- printf("Salary: %f\n", employees[i].salary);
- printf("DOJ: %s\n", employees[i].DOJ);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement