Saleh127

structure highest salary

Feb 27th, 2020
252
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. #include<stdio.h>
  2. typedef struct student
  3. {
  4. char s[100];
  5. int ID;
  6. char s1[100];
  7. float Salary;
  8. } std;
  9. struct student st[10];
  10. int displayInfo(std st[10])
  11. {
  12. for(int i=0; i<=1; i++)
  13. {
  14. printf("Name: %s\n",st[i].s);
  15. printf("ID: %d\n",st[i].ID);
  16. printf("Designation: %s\n",st[i].s1);
  17. printf("Salary: %.2f\n\n",st[i].Salary);
  18. }
  19. }
  20. int HS(std st[10])
  21. {
  22. if(st[0].Salary>st[1].Salary)
  23. printf("\n\nHighest Salary: %.2f\n",st[0].Salary);
  24. else
  25. printf("\n\nHighest Salary: %.2f\n",st[1].Salary);
  26. }
  27. int inputDATA()
  28. {
  29. for(int i=0; i<=1; i++)
  30. {
  31. scanf("%s",&st[i].s);
  32. scanf("%d",&st[i].ID);
  33. scanf("%s",&st[i].s1);
  34. scanf("%f",&st[i].Salary);
  35. }
  36. }
  37. int main()
  38. {
  39. inputDATA();
  40. displayInfo(st);
  41. HS(st);
  42. }
Advertisement
Add Comment
Please, Sign In to add comment