Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

uri 1042 solution in c

#include <stdio.h>
void printInOrder(int a, int b, int c)
{
    int min, mid, max;
    if(a < b && a < c){
        min = a;
        if(b < c){
            mid = b;
            max = c;
        }else{
            mid = c;
            max = b;
        }
    }else if(b < a && b < c){
        min = b;
        if(a < c){
            mid = a;
            max = c;
        }else{
            mid = c;
            max = a;
        }
    }else{
        min = c;
        if(a < b){
            mid = a;
            max = b;
        }else{
            mid = b;
            max = a;
        }
    }
    printf("%d
%d
%d
", min, mid, max);
}
int main()
{
    int a, b, c;
    scanf("%d %d %d", &a, &b, &c);
    printInOrder(a, b, c);
    printf("
%d
%d
%d
", a, b, c);
    return 0;
}
Source by www.beecrowd.com.br #
 
PREVIOUS NEXT
Tagged: #uri #solution
ADD COMMENT
Topic
Name
6+1 =