Answer to Question #302035 in C for Thriu

Question #302035

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.

1
Expert's answer
2022-02-24T12:19:32-0500
#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; 
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS