#include <stdio.h>
#include <conio.h>
int main()
{
int A[5]={1,2,3,4,5}, B[5]={2,4,6,8,10};
int C[10];
int a, b, c, t, p;
for(a=0; a<=4; ++a)
{
C[a]=A[a];
C[a+5]=B[a];
}
for(b=1; b<=9; ++b)
{
for(c=1; c<=10-b; ++c)
{
if(C[c]<C[c-1])
{ t=C[c-1];
C[c-1]=C[c];
C[c]=t;
}
}
}
for(p=0; p<10; ++p) printf("%d ", C[p]);
getch();
return 0;
}
No comments:
Post a Comment