Input
The input contains three integer numbers.
Output
Present the output as requested above.
Input Sample | Output Sample |
7 21 -14
|
-14
7 21 7 21 -14 |
-14 21 7
|
-14
7 21 -14 21 7 |
URI 1042 Solution in Python :
X,Y,Z = map(int,input().split())
list = [X,Y,Z]
list.sort()
print("%d\n%d\n%d"%(list[0],list[1],list[2]))
print("\n%d\n%d\n%d"%(X,Y,Z))
URI 1042 Solution in C :
#include <stdio.h>
int main() {
int x,y,z,p,q,r,t;
scanf("%d%d%d",&x,&y,&z);
p = x;
q = y;
r = z;
if (p>q)
{
t = p;
p = q;
q = t;
}
if (q>r)
{
t = q;
q = r;
r = t;
}
if (p>q)
{
t = p;
p = q;
q = t;
}
printf("%d\n%d\n%d\n\n%d\n%d\n%d\n",p,q,r,x,y,z);
return 0;
}
Comments
Post a Comment