#include <iostream>
int i_pow( int number , const int n );
int main()
{
const int number = 3456;
int digit = 0 , size = 0 , temp = number , power = 0;
while( temp > 0 )
{
++size;
temp /= 10;
}
temp = number;
for( int i = 0; i < size; ++i )
{
power = i_pow( 10 , size - 1 - i );
digit = temp / power ;
temp -= power * digit;
std::cout << "Digit " << i << " = " << digit << std::endl;
}
}
int i_pow( int number , const int n )
{
if( n > 0 ) return( number * i_pow( number , n - 1 ) );
return( 1 );
}
I2luY2x1ZGUgPGlvc3RyZWFtPgoKCmludCBpX3BvdyggaW50IG51bWJlciAsIGNvbnN0IGludCBuICk7CgppbnQgbWFpbigpCnsKCWNvbnN0IGludCBudW1iZXIgPSAzNDU2OwoJaW50IGRpZ2l0ID0gMCAsIHNpemUgPSAwICwgdGVtcCA9IG51bWJlciAsIHBvd2VyID0gMDsKCgl3aGlsZSggdGVtcCA+IDAgKQoJewoJICsrc2l6ZTsKCSB0ZW1wIC89IDEwOwoJfQoKCXRlbXAgPSBudW1iZXI7Cglmb3IoIGludCBpID0gMDsgaSA8IHNpemU7ICsraSApCgl7CiAgICAJcG93ZXIgPSBpX3BvdyggMTAgLCBzaXplIC0gMSAtIGkgKTsKICAgIAlkaWdpdCA9IHRlbXAgLyBwb3dlciA7CiAgICAJdGVtcCAtPSBwb3dlciAqIGRpZ2l0OwogICAgCQogICAgCXN0ZDo6Y291dCA8PCAiRGlnaXQgIiA8PCBpIDw8ICAiID0gIiA8PCBkaWdpdCA8PCBzdGQ6OmVuZGw7Cgl9Cn0KCmludCBpX3BvdyggaW50IG51bWJlciAsIGNvbnN0IGludCBuICkKewoJaWYoIG4gPiAwICkgcmV0dXJuKCBudW1iZXIgKiBpX3BvdyggbnVtYmVyICwgbiAtIDEgKSApOwoJcmV0dXJuKCAxICk7Cn0=