0

Can anybody tell me how can I find who is getting salary up to 4000 thousand, tell me what I am doing wrong humble request.

This Is The Code : #include <stdio.h> #include <stdlib.h> #include <string.h> // Create the student structure struct Employee { char* name; int emp_id; float salary; }; // Driver code int main() { int i = 0, n = 3, high; // Create the student's structure variable // with n Student's records struct Employee employee[n]; // Get the students data employee[0].name = "Ajay"; employee[0].emp_id = 1; employee[0].salary = 4897; employee[1].name = "Vijay"; employee[1].emp_id = 5; employee[1].salary = 4665; employee[2].name = "Akash"; employee[2].emp_id = 2; employee[2].salary = 7537; if (employee[0].salary >= employee[1].salary && employee[0].salary >= employee[2].salary ) printf("%f is the largest number.", employee[i].salary); // if n2 is greater than both n1 and n3, n2 is the largest if (employee[1].salary >= employee[0].salary && employee[1].salary >= employee[2].salary ) printf("%f is the largest number.", employee[i].salary); // if n3 is greater than both n1 and n2, n3 is the largest if (employee[2].salary >= employee[0].salary && employee[2].salary >= employee[1].salary) printf("%f is the largest number.", employee[i].salary); // Print the Employee information printf("Employee Records:\n\n"); for (i = 0; i < n; i++) { printf("\tName = %s\n", employee[i].name); printf("\tEmplyee Id= %d\n", employee[i].emp_id); printf("\tSalary = %f\n\n", employee[i].salary); } return 0; }

24th Dec 2021, 4:38 PM
Mr. A
Mr. A - avatar
2 Answers
+ 1
I made this code it might help you. https://code.sololearn.com/cgvOuTkLLF0P
24th Dec 2021, 5:33 PM
SoloProg
SoloProg - avatar
+ 1
@SoloProg Thanks for your corrections, but what if I have two person's getting salary greater than 5000 or n number of persons??? can you tell me ??
25th Dec 2021, 6:27 PM
Mr. A
Mr. A - avatar