#!/usr/bin/env cscript
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <strings.h>
#define ALPHABET "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

int
print_column_index(char column_string[3 + 1], int column_index) {
	bzero(column_string, sizeof(column_string)[0]);
	if ((column_string[0] = 'A' + column_index / strlen(ALPHABET) / strlen(ALPHABET) % strlen(ALPHABET) - 1) > 'Z') {
		return 1;
	}

	if ((column_string[1] = 'A' + column_index / strlen(ALPHABET) % strlen(ALPHABET) - 1) > 'Z') {
		return 1;
	}

	if ((column_string[2] = 'A' + column_index % strlen(ALPHABET) - 1) > 'Z') {
		return 1;
	}

	return 0;
}


int
main(int argc, const char *argv[]) {
	char column_index[3 + 1];

	printf("print_column_index %d\n", print_column_index(column_index, 16384));
	printf("16384 -> %s\n", column_index);
	return 0;
}