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
Artemon [7]
3 years ago
9

Sum of Numbers Design a function that accepts an integer argument and returns the sum of all the integers from 1 up to the numbe

r passed as an argument. For example, if 50 is passed as an argument, the function will return the sum of 1, 2, 3, 4, . . . 50. Use recursion to calculate the sum. Demonstrate the function in a program.
Engineering
1 answer:
cestrela7 [59]3 years ago
4 0

Answer:

# define main to get an argument from the user, call the function, and display the final values

def main():

 # ask an argument from the user.

 number = int(input('Enter a positive integer: '))

 # solve the integral thing of the number by putting the user's argument in the addition() function

 finalSum = addition(number)

 # display the final value integral thing

 print("The integral of this number is ", finalSum, ".")

# define an addition function to find the integral

def addition(num):

 # make an if-statement to test filter things out of your calculations. In this case, 1.

 if num == 1:

   #if 1, return 1. because 1 + (1 - 1) = 1

   return 1

 # this is where the recursion actually is. This is the part that calculates

 else:

   return num + addition(num-1)

# call your main function

main()

Explanation:

This is written in Python. A link to the output can be found below.

https://Sum-of-Numbers.hufflepuffler07.repl.run

You might be interested in
If superheated water vapor at 30 MPa iscooled at ​constant pressure​, it will eventually become saturated vapor, and with suffic
nirvana33 [79]

Answer:

False.

Explanation:

False. The pressure is above pressure at critical point (22.064 MPa.), the limit where pressure can prevent boiling.

3 0
3 years ago
An interrupted line of sight means changes in ......and .... are necessary for re-establishing a ......... to the driver’s path
Mrrafil [7]

Answer:

Welcome to Gboard clipboard, any text that you copy will be saved here.

Explanation:

Touch and hold a clip to pin it. Unpinned clips will be deleted after 1 hour.

5 0
2 years ago
What’s the difference between engineering stress and strain and true stress and strain
Nana76 [90]

True strain and engineering strain? True stress is defined as the load divided by the cross-sectional area of the specimen at that instant and is a true indication of the internal pressures. ... Engineering stress is defined as the load divided by the initial cross-sectional area of the specimenAnswer:

Explanation:

4 0
3 years ago
Read 2 more answers
For each resource, list 3 examples of how it would be used to produce a hamburger. Think outside of the “hamburger” box!
Olin [163]

Answer:

love

Explanation: you

/////////////////////

7 0
3 years ago
Design a plate and frame heat exchanger for the following problem:
qwelly [4]

Answer:

See explaination and attachment.

Explanation:

Iteration method is a repetitive method applied until the desired result is achieved.

Let the given equation be f(x) = 0 and the value of x to be determined. By using the Iteration method you can find the roots of the equation. To find the root of the equation first we have to write equation like below

x = pi(x)

Let x=x0 be an initial approximation of the required root α then the first approximation x1 is given by x1 = pi(x0).

Similarly for second, thrid and so on. approximation

x2 = pi(x1)

x3 = pi(x2)

x4 = pi(x3)

xn = pi(xn-1).

please go to attachment for the step by step solution.

8 0
3 years ago
Other questions:
  • Sed is a multipurpose tool that combines the work of several filters. sed performs noninteractive operations on a data stream. s
    12·1 answer
  • What's mutual inductance​
    8·1 answer
  • In order to protect yourself if you have a dispute with another drivers insurance company you should:
    9·1 answer
  • . A 10W light bulb connected to a series of batteries may produce a brighter lightthan a 250W light bulb connected to the same b
    8·2 answers
  • Determine the time required for a car to travel 1 km along a road if the car starts from rest, reaches a maximum speed at some i
    10·1 answer
  • Four eight-ohm speakers are connected in parallel to an audio power amplifier. The amplifier can supply a maximum driver output
    12·1 answer
  • Trees grow in bulk in outward direction​
    9·1 answer
  • Your sprayer has a 60-foot wide boom with 36 nozzles along this 60-foot length. Your spray speed is 4.5 miles per hour and you w
    15·1 answer
  • Shane's 100-watt radio draws 7 amps of current on a 120-volt circuit. What is the resistance in the radio?
    8·1 answer
  • What are the most used electronic tools for electronic works?​
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!