Declare the structure Employee, consisting of members variables are
emp_number, emp_name, department, salary and net_salary. Calculate
DA=20% of salary and display the information of an employee.
#inclust <stdio.h>
struct Employee {
int emp_number;
char *emp_name;
char *department;
double salary;
double net_salary;
};
double da(struct Employee *const emp) {
return 0.2 * emp->salary;
}
int main() {
struct Employee emp;
scanf("%d", emp.emp_number);
scanf("%s", emp.emp_name);
scanf("%s", emp.department);
scanf("%f", emp.salary);
scanf("%f", emp.net_salary);
printf("%f", da(emp));
return 0;
}
Comments
Leave a comment