logo CodeStepByStep logo

ListMystery1

Language/Type: C# List collections

Write the contents of each list if it were passed as a parameter to the following method:

public static void ListMystery1(List v)
{
    for (int i = 0; i < v.Count; i++)
    {
        int n = v[i];
        if (n % 10 == 0)
        {
            v.RemoveAt(i);
            v.Add(n);
        }
    }
}
{1, 20, 3, 40}
{80, 3, 40, 20, 7}
{40, 20, 60, 1, 80, 30}

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.