Advertisement
Guest User

Untitled

a guest
Feb 25th, 2020
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4.  
  5. char max_of3(int a, int b, int c);
  6.  
  7.  
  8. int main()
  9. {
  10. int a, b, c, max;
  11.  
  12. puts("Enter a, b and c:");
  13. scanf("%d %d %d", &a, &b, &c);
  14.  
  15. max = max_of3(a, b, c);
  16.  
  17. printf("Maximum of them: %c\n", max);
  18.  
  19. system("pause");
  20.  
  21. return 0;
  22. }
  23.  
  24. char max_of3(int fa, int fb, int fc)
  25. {
  26. int toReturn;
  27.  
  28. if (fa < fb)
  29. {
  30. toReturn = fb < fc ? 'c' : 'b';
  31. }
  32. else
  33. {
  34. toReturn = fa < fc ? 'c' : 'a';
  35. }
  36.  
  37. return toReturn;
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement