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

- 01-12-2013Oleg SuharevichMultiplication table using only recursion
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? - 01-12-2013std10093
The rule is as simple as this : You post your try and then you get feedback :)

- 01-12-2013Oleg Suharevich
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. - 01-12-2013std10093
Post your code in code tags next time, like this

[code]/*your program*/[/code]

I do not understand your problem :/ - 01-12-2013Oleg Suharevich
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. - 01-12-2013c99tutorial
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 - 01-12-2013Oleg Suharevich
I know , thank you