Settings | Sign in | Sign up

There is currently 1 post.

【试题】排序

Floor 1 巨大八爪鱼 3/4/16 10:05
#include <stdio.h>

void swap(int *a, int *b)
{
    int temp = *a;
    *a = *b;
    *b = temp;
};

int main()
{
    int a, b, c;
    scanf("%d%d%d", &a, &b, &c);
    if (a < b)
        swap(&a, &b);
    if (b < c)
        swap(&b, &c);
    if (a < b)
        swap(&a, &b);
    printf("%d %d %d", a, b, c);
    return 0;
}

Content converter:

Reply the post
Content:
User: You are currently anonymous.
Captcha:
Unclear? Try another one.
©2010-2025 Purasbar Ver3.0 [Mobile] [Desktop]
Except where otherwise noted, content on this site is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported license.