//方法一
int main()
{
int arr[3] = {0};
for (int i = 0; i < 3; i++)
{
scanf_s("%d", &arr[i]);
}
int sz = sizeof(arr) / sizeof(arr[0]);
for (int j = 0; j < sz-1; j++)
{
for (int v = 0; v < sz - 1 - j; v++)
{
if (arr[j] < arr[j + 1])
{
int tmp = arr[j + 1];
arr[j + 1] = arr[j];
arr[j] = tmp;
}
}
}
printf("%d", arr[1]);
return 0;
}
3.方法二:可以进行赋值,假设max的数字。
//方法二
int main()
{
int a = 0;
int b = 0;
int c = 0;
int max = 0;
scanf_s("%d %d %d", &a, &b, &c);
if (a > max)
max = a;
if (b> max)
max = b;
if (c > max)
max = c;
printf("%d", max);
return 0;
}