ayushajayverulkar
ayushajayverulkar ayushajayverulkar
  • 20-08-2021
  • Computers and Technology
contestada

Topic:

Recursion. Use recursion to display the pattern given above. No loops allowed.

See the picture for the pattern​

Topic Recursion Use recursion to display the pattern given above No loops allowed See the picture for the pattern class=

Respuesta :

tonb
tonb tonb
  • 20-08-2021

Answer:

const SIZE=8

function print(n, s) {

 if (n > 0) {

   process.stdout.write(s);

   print(n-1, s);

 }

}

function main(n=1) {

 if (n<=SIZE) {

   print(SIZE-n, "  ");

   print(n, "* ");

   process.stdout.write("\n");

   main(n+1);

 }

}

main();

Explanation:

Here is a solution in javascript. Note that it uses recursion multiple times to avoid loops.

Answer Link

Otras preguntas

there are some children at the zoo in the morning .20 more show up in the afternoon. now there are 62 children total at the zoo in the morning
A chemist has 40ml of 12% acid solution. how many ml of 25% solution would need to be added to get a mixture that is 20% acid? what is the total amount of the f
Explain how to graph the function using transformations seen in the function. f(x)=3(x+7)^3-9
Please help 3/10×4/5=
state two examples of homozygous pairs​
Which of the following is the overall goal of all territorial behavior? Responses PLEEASEEE HELPPPPP A. to maintain access to a particular type of environment B
Please helpppp and explain Find the function: 5[F(d)]
grafica [tex]5y-15=-4x[/tex]
Which founding father and prominent american legal scholar signed the declaration of independence and proposed the three-fifths compromise at the constitutional
And how many lions will it take to hunt the lion? Subject - Biology