程序代码:
#include <stdio.h>
#include <stdlib.h>
void main()
{
int a,i=0;
char p[4] = {0};
scanf("%d",&a);
(a<0 || a >=10000) ? printf("错误\n") : itoa(a,p,10);
while(i<4 && p[i] != NULL)
{
printf("第%d位:%c\n",i+1,p[i]);
i++;
}
strrev(p);
if(i>0) printf("倒序%s\n",p);
}