Tuesday, March 11, 2008

Find Destiny Number using C#

/*
A number derived from all of the letters in your FULL BIRTH NAME make up what is called the Destiny or Destiny number.
To arrive at your Destiny number, take each name separately and add up the letter values using the conversion chart below. Reduce each name to a single digit . Then add the results of all of the names to arrive at a total which you then once again reduce to a single digit.

Here is how to turn letters in the full name to a Destiny Number:
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 |
_____________________________________
| A | B | C | D | E | F | G | H | I |
| J | K | L | M | N | O | P | Q | R |
| S | T | U | V | W | X | Y | Z |

*/
private int FindDestinyNumber(string inputName)
{
inputName = inputName.ToUpper();
string str ="AJSBKTCLUDMVENWFOXGPYHQZIR";
string strWord="";int iDestNum=0;
for(int i=0; i < inputName.Length; i++)
{
strWord = inputName.Substring(i,1);
int idx = str.IndexOf(strWord)+1;
if(idx < 3)
iDestNum += 1;
else
{
int remainder = idx % 3;
if(remainder == 0)
iDestNum += idx/3;
else
iDestNum += (idx/3) + 1;
}
}
while(iDestNum > 9) {
string s = iDestNum.ToString();
iDestNum = Convert.ToInt32(s.Substring(0,1)) +
Convert.ToInt32(s.Substring(1,1));
}
return iDestNum;
}

0 Comments: