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 does the following Boolean operators do?<br>AND function<br>OR function<br>NOT function​
Alisiya [41]
Hdehehdbendjdhwjsjsjjs
6 0
2 years ago
In ________ for final fields and methods the value is assignedlater but in ______ you assign the value during declaration.
Oksi-84 [34.3K]

Answer:

The answer to this question is Java,C++.

Explanation:

We can assign non static final variables a value with the declaration or in the constructor but this is not the case with c++ because we have to assign value during declaration and c++ equivalent of final is const keyword and there is sealed or readonly keywords in c# not final.If we do not assign value at the time of declaration the const variable will contain garbage value which cannot be changed afterwards.

7 0
2 years ago
You are now going to prepare some reports for the company. Measurements are in metres and volume
romanna [79]

if you follow me and like and mark in brainliest answer only I will tell the answer

4 0
2 years ago
Identify and discuss the seven layers of the Open System Interconnection (OSI) model and their importance on TCP/IP operation.
a_sh-v [17]

Answer:

following are the OSI Layers

1.physical layer

2.datalink layer

3.network layer

4.transport layer

5.session layer

6.presentation layer

7.application layer

Explanation:

physical layer is used to transmit media,signal and binary information

datalink layer is used for physical addressing MAC and LLC

network layer is used for path determination and ip

transport layer is for end to end communication and reliability

session layer is for interhost communication

presentation layer is for data representation and encryption

application layer is network process to application

4 0
3 years ago
Haley is responsible for checking the web server utilization. Which things should she review while checking the server utilizati
const2013 [10]

Answer:

While checking the server utilizations, she should review CPU and RAM.

Explanation:

8 0
2 years ago
Read 2 more answers
Other questions:
  • 11.
    11·1 answer
  • When should students practice netiquette in an online course? Check all that apply.
    14·2 answers
  • The data in a data warehouse have which of the following characteristics?
    13·1 answer
  • A tool you might use to manipulate an image, such as a photograph, into a seamless repeating texture would be:
    7·2 answers
  • What is the term for an understanding about the processes that underlie memory, which emerges and improves during middle childho
    7·2 answers
  • Identify the type of error described
    6·1 answer
  • Type the correct answer in the box. Spell all words correctly.
    11·2 answers
  • What do you call a collection of pre-programmed commands and functions used in programs?
    10·1 answer
  • Laptop computers use PCMCIA cards, another type of ________
    15·1 answer
  • Why won't Brainly let me create an account? I have tried many times but it just loads.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!