1	#include <stdio.h>
     2	
     3	int mapping[] = {
     4		1, 1, 4, 2, 4, 4, 2, 1,
     5		5, 4, 4, 2, 1, 5, 2, 5, 
     6		5, 5, 4, 3, 3, 3, 3, 2, 
     7		5, 5, 
     8	};
     9	
    10	int num_calc(char array[11])
    11	{
    12	int i;
    13	int total=0;
    14	char c;
    15	
    16		for(i=0;i<sizeof(array)/sizeof(array[0]);i++)
    17			{
    18			c = array[i];
    19			if (c >= 'A' && c <= 'Z')
    20				total += mapping[(int)c-'A'];
    21			else if (c >= 'a' && c <= 'z')
    22				total += mapping[(int)c-'a'];
    23			}
    24	
    25	return total;
    26	}
    27	
    28	int main(int argc, char **argv) {
    29	char message[11] = {"Mystic Meg"};
    30	unsigned int num;
    31	
    32	if ((num = num_calc(message)))
    33		{
    34		/* reduce until its negative */
    35		do
    36			num -= 10;
    37		while(num>=0);
    38	
    39		/* Since we've overshot, add the last ten back*/
    40		num += 10;
    41	
    42		printf("The magic number for %s is %d\n", message, num);
    43		}
    44	
    45	return 0;
    46	}