I'v been asked to write the function that print the multiplication table until x*y using only recursion.
the function call will be mult(x,1,y);
void mult(int x, int base, int y).
Have any idea how to slove it?
Printable View
I'v been asked to write the function that print the multiplication table until x*y using only recursion.
the function call will be mult(x,1,y);
void mult(int x, int base, int y).
Have any idea how to slove it?
The rule is as simple as this : You post your try and then you get feedback :)
My idea was : to print (x/x)*base each row
And then to promote base.
printf("%2d ",base);
if(base==y) return;
mult_table(x,++base,y);
my problem is when i stop recursion it back with base =5 and i didnt found how to use it.
Post your code in code tags next time, like this
[code]/*your program*/[/code]
I do not understand your problem :/
Ill.
My problem is to print each row after the first one .
I print the first row 1-10
but when the recursion is start to return it back with base 10 (in case 10*10) and i cant use that base to print the next row.
Have no idea how I need to make it.
Any problem which can be solved iteratively can also be solved using recursion. Why not make the iterative version first and then try to convert it to a recursive version?
for x = 1 to 10
for y = 1 to 10
...
end for
end for
I know , thank you