m3(3, 4) will return 3 * m3(3, 3),
m3(3, 3) will return 3 * m3(3, 2),
m3(3, 2) will return 3 * m3(3, 1),
m3(3, 1) will return 3 * m3(3, 0) and
m3(3, 0) will return 1,
so in other words m3(3, 4) will return 3 * (3 * (3 * (3 * 1))) = 81.
analyze your own code ;)
m3 (3,4) = 3 * (3,3) = 3 * 3 * (3,2) = 3 * 3 * 3 * (3,1) = 3 * 3 * 3 * 3 * (3,0) = 3 * 3 * 3* 3 * 1 = 81
m2(3,4) = 4 + (2,4) = 4 + 4+ (1,4) = 4 + 4 + 4 + (0,4) = 4 + 4 + 4 + 0 = 12
Last edited on
Why are you duplicating your post in two section of the forum? Do not do that.