Title address: http://acm.nyist.net/JudgeOnline/problem.php?pid=41?? Describe
Now to write a program that implements a three-digit sort of function
Input
Enter a three positive integer
Output
Sort three positive integers for input
Sample input
20 7 33
Sample output
7 20 33? Code: #include <stdio.h>
static void swap (int *left,int *right);
int main ()
{
???? int a=0,b=0,c=0;
???? scanf ("%d%d%d", &a,&b,&c);
????
???? if (a>b)
???? {
????????? Swap (&A,&B);
???? }
????
???? if (a>c)
???? {
????????? Swap (&A,&C);
???? }
????
???? if (b>c)
???? {
????????? Swap (&B,&C);
???? }
????
???? printf ("%d%d%d\n", a,b,c);
????
???? return 0;
}
static void swap (int *left,int *right)
{
???? int tmp = *left;
???? *left = *right;
???? *right = tmp;
}? practiced hand question.???
Introduction to 13-language-13-three numbers from small to large sort