Problems with "Money Maker" Project in the C# Course

Hello everyone,

I am having difficulty in getting the code to produce the desired outcome in the test cases eg. 16 should produce an output of 1 gold coin, 1 silver coin, and 1 bronze coin; but it gives an output of 1 gold coin, and 1 bronze coin.

Can anyone spot where I have gone wrong, and what can be done to fix the code please?

Thanks in advance,


using System;

namespace MoneyMaker


  class MainClass


    public static void Main(string[] args)


      Console.WriteLine("Welcome to Money Maker!");

      Console.WriteLine("Enter an amount of money to convert to coins:");


      string amountMoney = Console.ReadLine();

      double money = Convert.ToDouble(amountMoney);

      Console.WriteLine($"{amountMoney} in the minimum number of coins is:");

      //coin values

      int goldValue = 10;

      int silverValue = 5;

      //number of gold coins and remainder

      double goldCoins = Math.Floor(money / goldValue);

      double leftOver = goldCoins % goldValue;


      //number of silver coins and remainder

      double silverCoins = Math.Floor(leftOver / silverValue);

      double remainder = leftOver % silverValue;

      // print number of coins

      Console.WriteLine($"Gold coins: {goldCoins}");

      Console.WriteLine($"Silver coins: {silverCoins}");

      Console.WriteLine($"Bronze coins: {remainder}");





might want to cast your eyes over this line again…

1 Like

That’s it!

I was pulling my hair out trying to fix this.

money % goldValue is working.


1 Like