実験3-3サイズ比較(10点)

この質問では、小から大までの3つの整数入力の出力が必要です。

入力フォーマット:

入力は、スペースで区切られた1行に3つの整数を与えます。

出力フォーマット:

小さいものから大きいものまで3つの整数を続けて出力し、それらを「->」で接続します。

入力例:

4 2 8
 

出力例:

2->4->8



#include <stdio.h>
int main()
{
    int fact(int、int、int);
    int a、b、c;
    scanf( "%d%d%d"、&a、&b、&c);
    fact(a、b、c);
    0を返します。
}
int fact(int x、int y、int z)
{
    int t;
    if(x> y)
    {
        t = x;
        x = y;
        y = t;
    }
    if(x> z)
    {
        t = x;
        x = z;
        z = t;
    }
    if(y> z)
    {
        t = y;
        Y = Z。
        z = t;
    }
    printf( "%d->%d->%d"、x、y、z);
    0を返します。
}

おすすめ

転載: www.cnblogs.com/wven/p/12686815.html