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
Welding, cutting, or heating in any enclosed spaces involving which of the following metals should be performed with local exhau
sweet [91]

steal aluminum iron

4 0
3 years ago
a force 2.4E2 N exists between a positive charge of 8E-5 C and a positive charge of 3E-5 C. What distance separates the charges?
Verdich [7]

The distance between the two charges is 0.3 m

Explanation:

The electrostatic force between two charged objects is given by Coulomb's law:

F=k\frac{q_1 q_2}{r^2}

where:

k=8.99\cdot 10^9 Nm^{-2}C^{-2} is the Coulomb's constant

q_1, q_2 are the charges of the two objects

r is the separation between the two charges

In this problem, we are given the following:

q_1 = 8\cdot 10^{-5} C

q_2 = 3\cdot 10^{-5} C

F=2.4\cdot 10^2 N

Therefore, we can rearrange the equation to solve for r, the distance between the two charges:

r=\sqrt{\frac{kq_1 q_2}{F}}=\sqrt{\frac{(8.99\cdot 10^9)(8\cdot 10^{-5})(3\cdot 10^{-5})}{2.4\cdot 10^2}}=0.3 m

Learn more about electrostatic force:

brainly.com/question/8960054

brainly.com/question/4273177

#LearnwithBrainly

6 0
3 years ago
A) State what is meant by absolute zero temperature.<br>​
Lynna [10]

Answer:

<u>Absolute </u><u>zero </u><u>temperature</u> is the lowest limit of the thermodynamic temperature scale, a state at which the enthalpy and entropy of a cooled ideal gas reach their minimum value, taken as zero kelvins.

3 0
3 years ago
When you are driving on a rural road, if your right wheels run off the pavement, you should hold the steering wheel firmly and
julia-pushkina [17]

Answer:

C). Take your foot off the gas pedal. Then brake lightly until you are moving at low speed.                    

Explanation:

While driving on roads of rural areas, if our right wheel moves off the pavement, we should always hold the steering wheel firmly and then take our foot off the gas pedal, then apply brake lightly until we are moving at a low speed.

      When our wheels drift off the pavement area, we should not panic and yank. And instead of turning the wheel back in the left direction towards the road, it is always safer to take off our foot from the gas pedal and then apply brakes slowly. When our vehicle slows down check the incoming traffic behind us and then we should slowly move back on to the pavement.

7 0
3 years ago
At the end of the Shock Wave roller coaster ride, the 6000-kg train of cars (includes passengers) is allowed from a speed of 20
Angelina_Jolie [31]

Answer:

56250 N

Explanation:

mass, m = 6000 kg

initial speed, u = 20 m/s

final speed, v = 5 m/s

distance, s = 20 m

Use third equation of motion

v^{2}=u^{2}+2as

5 x 5 = 20 x 20 + 2 a x 20

25 = 400 + 40 a

a = - 9.375 m/s^2

Braking force, F = mass x acceleration

F = 6000 x 9.375

F = 56250 N

6 0
3 years ago
Other questions:
  • How much energy becomes unavailable for work in an isothermal process at 440 k, if the entropy increase is 25 j/k?
    14·1 answer
  • Find the electric force acting on an alpha particle in a horizontal electric field of 600N/C
    10·1 answer
  • 4. A family leaves from New York City and is flying to Los Angles which is 2800mi away. It takes
    14·1 answer
  • Why are some scientists skeptical of the scientists results and conclusions
    6·1 answer
  • A bullet with a mass m b = 11.5 g is fired into a block of wood at velocity v b = 249 m/s. The block is attached to a spring tha
    10·1 answer
  • What force is needed to accelerate an object 5 m/s if the object has a mass of 10kg?
    5·1 answer
  • Which of these ideas was part of the earliest model of the atom?
    14·2 answers
  • The blackbody curve for a star named Zeta is shown below. What is the peak wavelength for this star?
    5·2 answers
  • If distance between two charges increased by 2 times then force
    14·1 answer
  • Given that ethylene has a λmax of 175nm, butadiene has a λmax of 220nm, and 2-methyl-1,3-butadiene has a λmax or 215nm, what is
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!