题解 | 最大最小值
最大最小值
https://www.nowcoder.com/practice/051cbca4504d40f5b20bb891d83ec408
#include <stdio.h>
int main() {
int a,b,c;
scanf("%d%d%d",&a,&b,&c);
int temp;
if(a>b)//确保a的值小于b
{
temp = a;
a = b;
b = temp;
}
if(a>c)//确保a的值最小
{
temp = a;
a = c;
c = temp;
}
if(b>c)//确保b的值小于c
{
temp = b;
b = c;
c = temp;
}
printf("The maximum number is : %d\n",c);//一般不要忘了'\n'
printf("The minimum number is : %d\n",a);
return 0;
}