fork download
  1. #include <stdio.h>
  2.  
  3. // Function prototype
  4. int MinIn3(int x, int y, int z);
  5.  
  6. int main() {
  7. int a, b, c;
  8.  
  9. // Prompt user for input
  10. printf("Enter 1st number: ");
  11. scanf("%d", &a);
  12.  
  13. printf("Enter 2nd number: ");
  14. scanf("%d", &b);
  15.  
  16. printf("Enter 3rd number: "); // Corrected "3th" to "3rd"
  17. scanf("%d", &c);
  18.  
  19. // Call function to find the minimum and display the result
  20. printf("Minimum is %d\n", MinIn3(a, b, c));
  21.  
  22. return 0;
  23. }
  24.  
  25. // Function to find the minimum of three numbers
  26. int MinIn3(int x, int y, int z) {
  27. int min = x; // Assume x is the minimum initially
  28.  
  29. if (y < min) {
  30. min = y; // Update min if y is smaller
  31. }
  32.  
  33. if (z < min) {
  34. min = z; // Update min if z is smaller
  35. }
  36.  
  37. return min; // Return the smallest number
  38. }
  39.  
  40.  
Success #stdin #stdout 0.01s 5288KB
stdin
Standard input is empty
stdout
Enter 1st number: Enter 2nd number: Enter 3rd number: Minimum is -40487696