52.随机数反转
/*
2 9 4 6 0 1 8 7 5 3
3 5 7 8 1 0 6 4 9 2
0-9 i---9-i
1-8 i---9-i
2-7 i---9-i
3-6 i---9-i
4-5 i---9-i
*/
#include "stdio.h"
#include "stdlib.h"
#include "time.h"
void main()
{
int i;
int num[10],t;
srand((unsigned)time(NULL));
for(i=0;i<=9;i++)
num[i]=rand()%1000;
for(i=0;i<=9;i++)
printf("%6d",num[i]);
for(i=0;i<10/2;i++)
{
t=num[i];
num[i]=num[9-i];
num[9-i]=t;
}
printf("\n");
for(i=0;i<=9;i++)
printf("%6d",num[i]);
}