#include <stdint.h>
#include <stdio.h>
static void putN( signed int );
int main()
{
putN( 100 );
putN( -100 );
putN( 12345 );
putN( 895102 );
putN( -1111 );
putN( 0x7fffffff );
putN( 0xffffffff );
return 0;
}
void putN( signed int n )
{
char s[13];
char*p = s + 12;
if ( n
== 0 ) { puts( "0" ); }
int nega = n < 0;
if ( nega ) { n = -n; }
*p-- = '\0';
while ( n > 0 ) {
*p-- = '0' + (n %10);
n /= 10;
}
if ( nega ) { *p-- = '-'; }
}
I2luY2x1ZGUgPHN0ZGludC5oPgojaW5jbHVkZSA8c3RkaW8uaD4KCnN0YXRpYyB2b2lkIHB1dE4oIHNpZ25lZCBpbnQgKTsKCmludCBtYWluKCkKewoJcHV0TiggMTAwICk7CglwdXROKCAtMTAwICk7CglwdXROKCAxMjM0NSApOwoJcHV0TiggODk1MTAyICk7CglwdXROKCAtMTExMSApOwoJcHV0TiggMHg3ZmZmZmZmZiApOwoJcHV0TiggMHhmZmZmZmZmZiApOwoJcmV0dXJuIDA7Cn0KCgp2b2lkIHB1dE4oIHNpZ25lZCBpbnQgbiApCnsKCWNoYXIgc1sxM107CgljaGFyKnAgPSBzICsgMTI7CglpZiAoIG4gPT0gMCApIHsgcHV0cyggIjAiICk7IH0KCglpbnQgbmVnYSA9IG4gPCAwOwoJaWYgKCBuZWdhICkgeyBuID0gLW47IH0KCQoJKnAtLSA9ICdcMCc7CgoJd2hpbGUgKCBuID4gMCApIHsKCQkqcC0tID0gJzAnICsgKG4gJTEwKTsKCQluIC89IDEwOwoJfQoJaWYgKCBuZWdhICkgeyAqcC0tID0gJy0nOyB9CgoJcHV0cyggcCArIDEgKTsKfQ==