Make change for a given amount given denominations Make change like at a cash register    

Input is the denominations of the currency and the sum
In test case only coins are entered   

Return how many of each denomination
Return the fewest possible denomination count (don't return all pennies)   

Check for style, efficiency, correctness, and anything else you want to check. 

// test
for (int i = 1; i &lt;= 200; i++)
{
    Dictionary&lt;int, int&gt; change = MakeChange(new List&lt;int&gt; { 1, 5, 10, 25, 50 }, i);
    Debug.WriteLine($"sum {i}");
    int sum = 0;
    foreach (KeyValuePair&lt;int, int&gt; coins in change)
    {
        sum += coins.Key * coins.Value;
        Debug.WriteLine($"  coin {coins.Key}  count {coins.Value} ");
    }
    if (i != sum)
    {
        Debug.WriteLine("problem");
    }
}
// end test

private static Dictionary&lt;int, int&gt; MakeChange(List&lt;int&gt; coins, int sum)
{
    if(sum &lt; 0 || coins.Count == 0)
    {
        throw new ArgumentOutOfRangeException();
    }
    Dictionary&lt;int, int&gt; change = new Dictionary&lt;int, int&gt;();
    foreach (int coin in coins.Distinct().Where(x =&gt; x &gt; 0).OrderByDescending(x =&gt; x))
    {               
        int j = sum / coin;  //integer math rounds down
        if (j &gt; 0)
        {
            change.Add(coin, j);
        }
        sum -= j * coin;
        if (sum == 0)
            return change;
    }
    return null;
}
You have implemented the greedy algorithm for making change: starting with the largest denomination, divide, then use the smaller coins to handle the remainder.

That works for many coin systems, but in the general case, it fails to produce optimal results:


  Greedy method
  
  For the so-called canonical coin systems, like the one used in US and many other countries, a greedy algorithm of picking the largest denomination of coin which is not greater than the remaining amount to be made will produce the optimal result. This is not the case for arbitrary coin systems, though: if the coin denominations were 1, 3 and 4, then to make 6, the greedy algorithm would choose three coins (4,1,1) whereas the optimal solution is two coins (3,3).


Therefore, if you want to use as few coins as possible, where the set of denominations is arbitrarily picked by the user, you have to use a different algorithm — typically one based on dynamic-programming.

So, either your code is wrong, or needs a comment to warn of that significant caveat.