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
Default tab stops are set in word every _______ inch. a. ¾ b. ½ c. 1 d. ¼
Dennis_Churaev [7]
A) 3/4 inch Meow! XD
6 0
3 years ago
PLEASE HELP I WILL GIVE BRAINLIEST AND 100 POINTS IF U ANSWER COMPLETELY WITHIN 30 MIN
icang [17]

Answer:

Explanation:

be themselves and that is more than enough to be beautiful. Lastly, I would organize the colorson each photo to be organized to make it look like flowers. That would add a nice touch to seemlike the unorganized pictures are actually organized.

7 0
3 years ago
A prime number is an integer greater than 1 that is evenly divisible by only 1 and itself. For example, the number 5 is prime be
Natasha_Volkova [10]

Answer:

Since no programming language is stated, python will by used.

Explanation:

def  isPrime():

#first we ask for a number that will be tested

   data= int(input("please enter a number"))

#the next line is where the number will be tested to see if its a prime

   if (data>1):

       if(data % 2)==1:

           print("true")

       else:

           print("False")

   else:

       print("Enter a number greater than 1")

isPrime()

3 0
4 years ago
Read 2 more answers
A major ozone depletion happened in the 1900s. What was it caused by
melomori [17]
It was caused by air pollution and the extreme heat built up underneath it. <span />
3 0
4 years ago
Read 2 more answers
The purpose of a report is to
suter [353]

Answer:

c

Explanation:

Reports communicate information which has been compiled as a result of research and analysis of data and of issues

3 0
3 years ago
Other questions:
  • Write a function that accepts a list as an argument (assume the list contains integers) and returns the total of the values in t
    10·1 answer
  • Stamps offers at-home postage and mailing for a monthly fee. Customers are able to carry a balance on their accounts that allows
    7·1 answer
  • Write a program to print the value of a series of numbers from0-9 in descending order
    12·1 answer
  • 1. Some of the music in the 1960s was used to protest social and political issues. Is music still used as a form of protest? Why
    13·1 answer
  • What is a secondary storage medium that uses magnetic techniques to store and retrieve data on disks or tapes coated with magnet
    6·1 answer
  • Computers have small bumps on the keyboards that enable persons to type without looking at the keyboard. These letters are:
    6·2 answers
  • The primary purpose of an operating system is: To provide a software interface between the hardware and the application programs
    11·1 answer
  • What is the command to list files in Unix and Unix like operating system?​
    15·1 answer
  • Match the parts of a CPU to their functions. Thanks in advance.
    7·1 answer
  • Enter a formula in cell C13 to look up the registration fee for the first vehicle. Use the vehicle type in cell C4 as the Lookup
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!