hi i have a function to calculate the max and the min of three numbers as follows. But i want to use these two functions to find out the middle number. Please help.
#include <stdio.h>
int minof3(int a, int b, int c);
int maxof3(int a, int b, int c);
main()
{
int a,b,c,middle_value;
printf("Enter the first number=> "
scanf("%d", &a);
printf("Enter the second number=> "
scanf("%d", &b);
printf("Enter the third number=> "
scanf("%d", &c);
printf("\n"
maxof3(a,b,c);
minof3(a,b,c);
// middle_value=a+b+c-maxof3(a,b,c)-minof3(a,b,c);
//printf("The middle value is %d \n",middle_value);
printf("\n" printf("\n"
}
int maxof3(int a, int b, int c)
{
if (a>b && a>c) printf("%d is the highest number \n\n",a);
else if (b>c && b>a) printf("%d is the highest number \n\n",b);
else if (c>a && c>b) printf("%d is the highest number \n\n",c);
}
int minof3(int a, int b, int c)
{
if (a<b && a<c) printf("%d is the lowest number \n\n",a);
else if (b<c && b<a) printf("%d is the lowest number \n\n",b);
else if (c<a && c,b) printf("%d is the lowest number \n\n",c);
printf("\n"
}
#include <stdio.h>
int minof3(int a, int b, int c);
int maxof3(int a, int b, int c);
main()
{
int a,b,c,middle_value;
printf("Enter the first number=> "
scanf("%d", &a);
printf("Enter the second number=> "
scanf("%d", &b);
printf("Enter the third number=> "
scanf("%d", &c);
printf("\n"
maxof3(a,b,c);
minof3(a,b,c);
// middle_value=a+b+c-maxof3(a,b,c)-minof3(a,b,c);
//printf("The middle value is %d \n",middle_value);
printf("\n" printf("\n"
}
int maxof3(int a, int b, int c)
{
if (a>b && a>c) printf("%d is the highest number \n\n",a);
else if (b>c && b>a) printf("%d is the highest number \n\n",b);
else if (c>a && c>b) printf("%d is the highest number \n\n",c);
}
int minof3(int a, int b, int c)
{
if (a<b && a<c) printf("%d is the lowest number \n\n",a);
else if (b<c && b<a) printf("%d is the lowest number \n\n",b);
else if (c<a && c,b) printf("%d is the lowest number \n\n",c);
printf("\n"
}