fork download
  1. #include <stdio.h>
  2.  
  3. int main() {
  4. int num1, num2, num3;
  5. int min, max;
  6. float result;
  7.  
  8. printf("*** Find (Minimum + Maximum) / Maximum ***\n");
  9. printf("Enter 3 integers : ");
  10. scanf("%d %d %d", &num1, &num2, &num3);
  11.  
  12. // หา Minimum
  13. if (num1 <= num2 && num1 <= num3) {
  14. min = num1;
  15. } else if (num2 <= num1 && num2 <= num3) {
  16. min = num2;
  17. } else {
  18. min = num3;
  19. }
  20.  
  21. // หา Maximum
  22. if (num1 >= num2 && num1 >= num3) {
  23. max = num1;
  24. } else if (num2 >= num1 && num2 >= num3) {
  25. max = num2;
  26. } else {
  27. max = num3;
  28. }
  29.  
  30. // คำนวณผลลัพธ์
  31. result = (float)(min + max) / max;
  32.  
  33. // แสดงผลลัพธ์
  34. printf("(Min + Max) / Max = (%d + %d) / %d = %.5f\n", min, max, max, result);
  35.  
  36. return 0;
  37. }
Success #stdin #stdout 0s 5284KB
stdin
Standard input is empty
stdout
*** Find (Minimum + Maximum) / Maximum ***
Enter 3 integers : (Min + Max) / Max = (-1596911152 + 32766) / 32766 = -48735.83203