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
Why is computer called information processing maching???​
Vaselesa [24]

☆ <u>Since, the computer accepts raw data as input and converts into information by means of data processing, it is called information processing machine (IPM).</u>

HOPE IT HELPS ❣️

7 0
3 years ago
Read 2 more answers
g What field in the IPv4 datagram header can be used to ensure that a packet is forwarded through no more than N routers? When a
ad-work [718]

Answer:

a) Time to live field

b) Destination

c) Yes, they have two ip addresses.

d) 128 bits

e) 32 hexadecimal digits

Explanation:

a) the time to live field (TTL) indicates how long a packet can survive in a network and whether the packet should be discarded. The TTL is filled to limit the number of packets passing through N routers.

b) When a large datagram is fragmented into multiple smaller datagrams, they are reassembled at the destination into a single large datagram before beung passed to the next layer.

c) Yes, each router has a unique IP address that can be used to identify it. Each router has two IP addresses, each assigned to the wide area network interface and the local area network interface.

d) IPv6 addresses are represented by eight our characters hexadecimal numbers. Each hexadecimal number have 16 bits making a total of 128 bits (8 × 16)  

e) IPv6 address has 32 hexadecimal digits with 4 bits/hex digit

4 0
3 years ago
ShellShock had the potential for an unauthorized user to gain access to a server. It affected many internet-facing services, whi
mina [271]

Answer: Windows

Explanation:

ShellShock: Also called Bashdoor, it is a security bug which is found in the Bash shell of operating system e.g. Unix. It allows the hacker to execute scripts and commands by gaining unauthorized access. This affects many machines, devices that use Bash. Servers like web servers are most affected as most of them run Unix based OS like OS X. Most vulnerable are those who use Unix or Linux operating systems.  

Microsoft Windows does not use Bash so it does not directly affect Windows os. For those who are using Windows PC, Windows phones and websites that are developed by MS software are non-vulnerable to ShellShock.

4 0
3 years ago
why is it useful to learn how to solve and program solutions with a limited set of command in computer science
12345 [234]

Answer:

Give at least one reason why it's useful to learn how to solve and program solutions with a limited set of commands. So that when there is more commands we know how to use the ones we have. parameters help generalize the solution to a specific problem. how are functions with parameters an example of abstraction?

4 0
2 years ago
The science of networking is attributed to which government's involvement?
worty [1.4K]

Answer:

The United States

if I am not mistaken

6 0
2 years ago
Other questions:
  • _____ is an information-analysis tool that involves the automated discovery of patterns and relationships in a data warehouse.
    12·1 answer
  • Write a program that lets a maker of chips and salsa keep track of their sales for five different types of salsa they produce: mi
    8·1 answer
  • 3. What is the purpose of the conclusion in an expository essay? (1 point)
    8·2 answers
  • what is it called when someone uses software to run multiple operating systems on one computer at the same time? A.functional vi
    9·1 answer
  • 3. Before you get ready to go diving, you want to explore the area. You see a small snowpack across a small bridge, a short walk
    11·1 answer
  • Which devices typically generate computer output ?
    8·2 answers
  • The goal expressed in this definition states that data visualization is about ________________ .
    11·2 answers
  • When a JSP page is compiled, what is it turned into?
    11·1 answer
  • Assume the size of an integer array is stored in $s0 and the address of the first element of the array in the memory is stored i
    10·1 answer
  • Which type of shape allows you to add text that can be moved around.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!