Step 2 : Getting rid of 0 , as 0 is not part of number system
for ( int j = 0 ; j < i - 1 ; j ++ ) { if ( arr [ j ] <= 0 ) { arr [ j ] += 26 ; arr [ j + 1 ] = arr [ j + 1 ] - 1 ; } } for ( int j = i ; j >= 0 ; j -- ) { if ( arr [ j ] > 0 ) cout << char ( ' A ' + arr [ j ] - 1 ) ; } cout << endl ; }