Advertisement
Guest User

Untitled

a guest
Feb 16th, 2020
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.88 KB | None | 0 0
  1. #include <stdio.h>
  2. struct employee
  3. {
  4. char name[20];
  5. int age;
  6. int salary;
  7.  
  8. };
  9. int display(struct employee salary);
  10. void main()
  11. {
  12.  
  13. struct employee e[10];
  14. int i;
  15. for(i=0;i<=9;i++)
  16. {
  17. printf("enter name;");
  18. gets(e[i].name);
  19. printf("enter age");
  20. scanf("%d",&e[i].age);
  21. printf("enter salary;");
  22. scanf("%d",&e[i].salary);
  23. }
  24. display(employee salary);
  25. printf("EMPLOYEES DETAIL::");
  26. printf("Name:/t Age:\t salary:\t");
  27. for (i=0;i<=9;i++)
  28. {
  29. printf("%s\t %d\t %d\t",e[i].name,e[i].age,e[i].salary);
  30. }
  31. }
  32. int display(struct employee salary)
  33. {int temp,i;
  34. for(i=0;i<=9;i++)
  35. {
  36. if (e[i].salary<e[i+1].salary)
  37. {
  38. temp=e[i+1].salary;
  39. e[i+1].salary=e[i].salary;
  40. e[i].salary=temp;
  41. return e[i].salary;
  42. }
  43. }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement