Q:

C# - Display int value by inputting int name

say for example I want to create a very simple program that stored and displayed chemistry elements Mass numbers, how would do I display the int value by inputting the int name?? 
Console.Write("Element Symbol:");
Console.ReadLine();

int Li = 7;
int Be = 9;

Console.WriteLine("Mass Number:");

???? Sorry for the stupid questions but help is appreciated 

A:

It would be more appriopiate to have a mapping from Element symbol --> Mass. You should create a Dictionary<string, int> for that, that stores the mass for each element (the element's name is the key, the mass is the value). As pointed out by another comment, make the mass float or a double instead of an int if you desire.
private Dictionary<string, int> PeriodicTable =
    new Dictionary<string, int>()
    {
        {"Li", 5 },
        {"Be", 9 }
        //more elements..
    };

private int GetMass(string element)
{
    int value = 0;
    //Try to get the value
    if (PeriodicTable.TryGetValue(element, out value))
        return value;
    else //not found
        return -1;
}

If you find this too complicated, use a classical switch statement.
private int GetMass(string element)
{
    switch(element)
    {
        case "Li":
            return 5;
        case "Be":
            return 9;
        //..
        default:
            return -1;
    }
}

