How to resolve the algorithm Count the coins step by step in the MAD programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Count the coins step by step in the MAD programming language

Table of Contents

Problem Statement

There are four types of common coins in   US   currency:

There are six ways to make change for 15 cents:

How many ways are there to make change for a dollar using these common coins?     (1 dollar = 100 cents).

Less common are dollar coins (100 cents);   and very rare are half dollars (50 cents).   With the addition of these two coins, how many ways are there to make change for $1000? (Note:   the answer is larger than   232).

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Count the coins step by step in the MAD programming language

Source code in the mad programming language

            NORMAL MODE IS INTEGER
            DIMENSION TAB(101)

            THROUGH ZERO, FOR N = 1, 1, N.G.100
ZERO        TAB(N) = 0
            TAB(0) = 1

            THROUGH STEP, FOR VALUES OF COIN = 1, 5, 10, 25
            THROUGH STEP, FOR N = COIN, 1, N.G.100
STEP        TAB(N) = TAB(N) + TAB(N - COIN)

            VECTOR VALUES FMT = $I3*$
            PRINT FORMAT FMT, TAB(100)
            END OF PROGRAM

  

You may also check:How to resolve the algorithm Loops/Increment loop index within loop body step by step in the Quackery programming language
You may also check:How to resolve the algorithm Least common multiple step by step in the Forth programming language
You may also check:How to resolve the algorithm Gamma function step by step in the Lua programming language
You may also check:How to resolve the algorithm N'th step by step in the Nanoquery programming language
You may also check:How to resolve the algorithm Own digits power sum step by step in the Phix programming language