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
Jenn wants to assign a value to the favorite car variable: favoriteCar = Toyota but gets an error message. What does she need to
Bumek [7]

Answer:

The correct answer is: Option d: Put Quotation marks around the string.

Explanation:

The names of things or places or cars are usually in the form of words or sentences. The words or sentences are stored in string datatype.

Quotation marks are used to deal with strings in programming languages.

Hence,

The correct answer is: Option d: Put Quotation marks around the string.

3 0
3 years ago
_____ is the operation of setting a variable to a value.
Helen [10]

Answer:

Assignment is the operation of a variable to a value

3 0
3 years ago
Asymmetric key encryption combined with the information provided by a. certificate authority allows unique identification of the
Nesterboy [21]

Answer:

c. both the user and the provider of encrypted data.

Explanation:

In assymetric key encryption, you will need the public key of the sender to decode the information along with your private key to decode the encrypted information. if you don't have any of the keys, you won't be able to read the information. You must have both in order to read the information sent.

5 0
3 years ago
True or false? If you’re posting the same content across different channels, make sure you post them simultaneously—on the same
alukav5142 [94]

Answer:

The answer is true.

Explanation:

7 0
3 years ago
Internet Security: How can you work securely on the internet? What actions should be avoided and what are the pitfalls?
Cerrena [4.2K]

Answer:First of all, to work safely at the internet you should avoid any not secure page, and if you can’t do that, avoid entering stuff such as credit cards or passwords on this sites. Now, to work safely it’s recomendable to have a VPN(virtual private network), that hides your IP direction.

Explanation:

8 0
3 years ago
Other questions:
  • A company decides to create static design diagrams for an upcoming project. Which statement correctly describes the attribute of
    6·1 answer
  • 1.
    13·1 answer
  • If you and another person want to encrypt messages, what should you provide that person with?
    10·1 answer
  • Setting the isShowing property to false of the opacity property to o will delete an object from an Alice world.
    15·2 answers
  • Do you have to make a account of Windows 10?
    12·1 answer
  • How is primary storage different from secondary storage? Select the TWO correct statements. The CPU can only read and write data
    12·2 answers
  • Which view is most often used to reorder slides in a presentation that has already been created?
    15·2 answers
  • In 1980, IBM's cheapest computer was more affordable than Apple's.<br><br><br> True<br><br> False
    10·1 answer
  • Database queries is an example of
    14·1 answer
  • Under which menu would you be able to see the number of continuous track minutes available on each mounted hard drive at the cur
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!