public class BelgiumTaxIdentificationNumber
public static void Main()
bool isValid = isValidBTIN("00012511148");
Console.WriteLine(isValid);
private static bool authenticateMonth(int month)
private static bool authenticateDate(int date)
private static bool authenticateBTIN(string btin, int key)
int answer = 97 - Convert.ToInt32(btin) % 97;
answer = 97 - Convert.ToInt32(string.Concat("2",btin)) % 97;
if (answer != key) return false;
private static bool isValidBTIN(string btin)
if (btin.Length != 11) return false;
int month = Convert.ToInt32(btin.Substring(2,2));
if (!authenticateMonth(month)) return false;
int date = Convert.ToInt32(btin.Substring(4,2));
if (!authenticateDate(date)) return false;
int wholestring_check = Convert.ToInt32(btin.Substring(9, 2));
string wholestring = btin.Substring(0, btin.Length - 2);
if (!authenticateBTIN(wholestring, wholestring_check)) return false;