#include<stdio.h>
int main()
{
int a, b, c;
int nMin, nMax, nSum;
printf("Enter 3 numbers separated by spaces: ");
scanf("%d %d %d", &a, &b, &c);
nMin = a;
nMax = a;
nSum = a + b + c;
/* minimum */
if (b < nMin)
{
nMin = b;
}
if (c < nMin)
{
nMin = c;
}
/* maximum */
if (b > nMax)
{
nMax = b;
}
if (c > nMax)
{
nMax = c;
}
printf("Max: %d\n", nMax);
printf("Min: %d\n", nMin);
printf("Sum of %d, %d and %d: %d\n", a, b, c, nSum);
return 0;
}
Comments
Leave a comment