Inside the recursion function in the if section (plus == 0) you must type the \ n character and then use the loop to call the visual (number) number of times.
If you really want to do this only with recursions, you will also need another recursive function. One recursion function will call another, one will print "+++++ \ n", and the other will call this function x times to create x number of lines.
function printpluses (int x){ if (x==0){ printf ("\n"); return; } else { printf ("+"); printpluses (x-1); } }
and another function will be
function printline (int x, int no_of_pluses){ if (x==0){ printf ("\n"); return; } else{ printpluses(no_of_pluses); printline (x-1, no_of_pluses); } }
you can make no_of_pluses global so you don't go through it in every call.
source share