1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
bogdanovich [222]
3 years ago
5

Implement a recursive program that takes in a number and finds the square of that number through addition. For example if the nu

mber 3 is entered, you would add 3+3+3=9. If 4 is entered you would add 4+4+4+4=16. This program must be implemented using recursion to add the numbers together. mips

Computers and Technology
1 answer:
lubasha [3.4K]3 years ago
3 0

Answer:

def recurSquare(n):

   if n == 0:

       return 0

   return recurSquare(n-1) + n + n-1

print(recurSquare(2))

Explanation:

Programming language used is Python.

The recursive function is defined as  recurSquare(n)

The IF statement checks the argument that is passed to the function to ensure it is not equal to zero.

The function is a recursive function, which means it calls itself.

In the return statement the function calls itself and the argument is reduced by 1.

The function keeps calling itself until n is equal to zero (n == 0) it returns zero and the function stops.

You might be interested in
A computer user who purchases a software package that will not operate on his or her hardware configuration is a victim of which
Natalija [7]
Is this a math problem? I don't get what you are trying to say sorry
5 0
3 years ago
3 Characteristics of Newton’s law’s.
polet [3.4K]

Answer:

In the first law, an object will not change its motion unless a force acts on it. In the second law, the force on an object is equal to its mass times its acceleration. In the third law, when two objects interact, they apply forces to each other of equal magnitude and opposite direction.

Explanation:

4 0
3 years ago
Write short cut of<br> fully justified​
Slav-nsk [51]

Answer:

To make text justified, select and highlight the text first, then hold down Ctrl (the control key) on the keyboard and then press J. To make the text left aligned again, press and hold down Ctrl on the keyboard and press L

4 0
3 years ago
There’s only one granola bar left out of the pan of 10 bars if Will and Rachel decide to split the last granola bar what fractio
maks197457 [2]
Do not know about the beachfront
the last bar is 1/10    half of that is 1/10  x 1/2   which equals   1/20
8 0
3 years ago
Which management function do leaders perform first when an organization begins a project?
riadik2000 [5.3K]

Answer:

PLANING

Explanation:

They include: planning, organizing, leading, and controlling. You should think about the four functions as a process, where each step builds on the others. Managers must first plan, then organize according to that plan, lead others to work towards the plan, and finally evaluate the effectiveness of the plan.

6 0
4 years ago
Other questions:
  • How can supply and demand for different careers affect job stability and income?
    6·1 answer
  • Josh wants to convey his best wishes to johnathin for a meeting schedualed later diring the day. Which business documented would
    7·1 answer
  • Well this isn't school related, but how do i watch dubbed and subbed anime for free on my computer?
    7·2 answers
  • An aircraft departs an airport in the mountain standard time zone at 1615 MST for a 2-hour 15-minute flight to an airport locate
    14·1 answer
  • What is the correct order of headers, from left to right, in a completed frame?
    8·1 answer
  • At which track meet did two runners finish in a time equivalent to the mode?
    14·1 answer
  • Which feature allows you to copy attributes of
    11·1 answer
  • Type (dog, cat, budgie, lizard, horse, etc.) Create a class that keeps track of the attributes above for pet records at the anim
    7·1 answer
  • A table of contents does not _____ automatically [customize table of contents]
    6·1 answer
  • When it comes to credit scores, why is having a
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!