fork download
  1. char* uitoa ( unsigned number, char* buf, int base )
  2. {
  3. char digits[] = "0123456789ABCDEFGHIJLKMNOPQRSTUVWXYZ";
  4. char stack [ 256 ];
  5. int i = 0, j = 0;
  6. while ( number )
  7. stack [ i++ ] = digits [ number % base ], number /= base;
  8. buf [ i ] = 0;
  9. while ( i > 0 )
  10. buf [ j++ ] = stack [ --i ];
  11. return buf;
  12. }
  13.  
  14. int main ( void )
  15. {
  16. char buf [ 256 ];
  17. int base, number;
  18. if ( 1 == scanf ( "%d", &number ))
  19. for ( base = 2; base < 37; base++ )
  20. printf ( "%s(%u)\n", uitoa ( number, buf, base ), base );
  21. return 0;
  22. }
Success #stdin #stdout 0.01s 1724KB
stdin
4711
stdout
1001001100111(2)
20110111(3)
1021213(4)
122321(5)
33451(6)
16510(7)
11147(8)
6414(9)
4711(10)
35A3(11)
2887(12)
21B5(13)
1A07(14)
15E1(15)
1267(16)
G52(17)
E9D(18)
D0I(19)
BFB(20)
AE7(21)
9G3(22)
8LJ(23)
847(24)
7DB(25)
6P5(26)
6CD(27)
607(28)
5HD(29)
571(30)
4RU(31)
4J7(32)
4AP(33)
42J(34)
3TK(35)
3MV(36)