I need to invert a sequence of numbers, for example, if I insert 1234, I print 4321. The code is working, but for entries of type 0123 or 1230 the zero is simply "deleted", but I needed zero was also displayed on the screen. I could not think or find a solution to this, can anyone help me?
int main()
{
long n;
long inverso;
scanf("%ld",&n);
do
{
inverso=n%10;
printf("%ld",inverso);
n/=10;
}while(n>0);
printf("\n");
return 0;
}