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

14) Modify the method that calculates the sum of the integers between 1 and N. Have the new version match the following recursiv

e definition: The sum of 1 to N is the sum of 1 to (N/2) plus the sum of (N/2 1) to N. Trace your solution using an N of 7.
Physics
1 answer:
Setler [38]3 years ago
8 0

Explanation:

Let solve the program using Java programming language

Method: method means group of statements to perform some operation.

             let call the method sum.

Parameters: list of variables that are use in the method for declaration.

<u>The code</u>

public int sum (int number)

int answer;

if (number == 1)

answer = number;

else

{

int half = number/2;

int span = number - half;

answer = sum(half) + sum(span) + (half * span);

}

answer result;

}

Firstly we defined the method called sum(), the method takes only one parameter which is number and return the answer(sum of  the integers 1 and N).

if the number is equal to 1, so it will return the number and if the number is not equal to 1 it will divide the number by 2 and get the span(span used to shift upper range).And result will add sum of half, sum of span and product of half span.

You might be interested in
How do you know the force for an acceleration of zero?
Natali5045456 [20]
F=ma

So a=F/m

if acceleration is zero, resultant force is also zero.
5 0
3 years ago
What quantities belong in cells X and Y?
satela [25.4K]

Answer:

X: period

Y: tangential speed

Explanation:

100% on quiz your welcome(:

6 0
2 years ago
A climber pulls herself 8 meters upwards with a force of 150 Newtons. If it takes her 16 seconds to cover the 8 meters, how much
mr Goodwill [35]

Answer:

 P = 75 W

Explanation:

given,

Distance, L = 8 m

Force,F = 150 N

Time, t = 16 s

Work by the climber

Work done = Force x displacement

W = F. L

W = 150 x 8

W = 1200 J

We know,

Power =\dfrac{Work\ done}{time}

P =\dfrac{1200}{16}

 P = 75 W

Hence, Power climber is using to climb is equal to 75 W.

3 0
3 years ago
2. Moving ocean water exerts a force of 375 N on a boat, causing the boat to move a distance of 34.7 m in 8.34 s. What power doe
sasho [114]
1.56 kW , working shown in photo

8 0
3 years ago
N a scientific investigation, what is the name for a prediction that can be tested?
ELEN [110]

A hypothesis is an educated prediction that can be tested.

8 0
3 years ago
Other questions:
  • 3. What is the potential difference across a 1 500 12 resistor carrying a
    10·1 answer
  • The German V-2 rocket was the first man made object in space
    13·1 answer
  • Which substance is used in fertilizers?
    12·2 answers
  • My Notes A flat loop of wire consisting of a single turn of cross-sectional area 7.80 cm2 is perpendicular to a magnetic field t
    10·1 answer
  • If the frequency of an electromagnetic wave is too high or too low. A) It cannot be seen. B) It is no longer a wave. C) It is no
    5·1 answer
  • How would a small bar magnet be oriented when placed at position x?
    13·2 answers
  • hai bản song song có chiều rộng là 10cm để cách nhau một khoảng d=0,1 mm và được nhúng bờ dưới vào trong nước. Tính lực cần đặt
    5·1 answer
  • A 100kg car travels at 2m/s. what is the momentum in kg
    7·1 answer
  • List out some use of atmospheric pressure​
    8·2 answers
  • Which of the following are vector quantities?
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!