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
What is stored in a source file, an object file, and his executable file?
neonofarm [45]
A source file has source code, what a human understands. It isn't compiled or linked.

An object file has compiled, but not linked intermediary code.

An executable file has compiled and linked code which is executable.
6 0
3 years ago
Excel - To clear the active cell, you can use the Ribbon, the keyboard, or the mouse.
____ [38]
The answer to your question is true
8 0
3 years ago
Do u see abs??????????
vichka [17]

Answer

of course, y u askin tho, im pretty sure every person who doesnt have a sight disability can see her abs as well

Explanation:

4 0
3 years ago
"A collective of online communications channels that enables users to create and share content and participate in a community-ba
DIA [1.3K]

Answer:

A collective of online communications channels that enables users to create and share content and participate in a community-based input, interaction, and collaboration, is called <u>Social Media.</u>

3 0
3 years ago
Which of the follwing are examples of meta-reasoning?
Vikentia [17]

Answer: B. Since I usually make the wrong decision and the last two decisions I made were correct, I will reverse my next decision.

C. I am getting tired so I am probably not thinking clearly

Explanation:

Meta-Reasoning simply refers to the processes which monitor how our reasoning progresses and our problem-solving activities and the time and the effort dedicated to such activities are regulated.

From the options given, the examples of meta reasoning are:

B. Since I usually make the wrong decision and the last two decisions I made were correct, I will reverse my next decision.

C. I am getting tired so I am probably not thinking clearly

7 0
3 years ago
Other questions:
  • Who is the primary audience for demonstrations of game prototypes made by the developer?
    8·1 answer
  • All queries have an explicit location. true of false
    13·2 answers
  • When a program terminates because a thrown exception is not handled, the program:
    6·1 answer
  • What is the importance of computer application to statistics​
    6·1 answer
  • When specifying keywords to conduct an internet search, which of the following parts of speech will be the most useful??
    6·1 answer
  • On a Linux system it is considered bad manners to create files and folders in the _______________ directory.
    14·1 answer
  • To excel at these professions, you need to be able to combine an eye for elegant design with a mind that delights in efficient o
    8·1 answer
  • Xbox one is not turning on and power brick is orange why is that?​
    6·1 answer
  • Which two peripherals are not required to browse the internet?
    8·1 answer
  • Explain the measures put in place in order to maintain each of the element of computer security<br>​
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!