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
You serve a volleyball with a mass of 2.1 kg. The ball leaves your hand with a speed of 30 m/s. The ball has—— energy. Calculate
Slav-nsk [51]

Answer:

945 j

Explanation:

You have just given the ball kinetic energy, which is given by the following equation:

KE= 1⁄2 m v2 = 1⁄2 (2.1 kg)(30 m/s)2 = 945 Joules

3 0
4 years ago
PLEASE HELP!! I’ll give brainliest pls
marin [14]

Answer:

A

Explanation:

houses use alternating current source

6 0
3 years ago
The term "ideal gas" refers to a gas for which certain assumptions have been made. Which of the following is not such an assumpt
Jobisdone [24]

Answer:

(A) Consists of a small number of tiny particles that are far apart- relative in their size.

Explanation:

An <em>ideal gas</em> is defined as a simplification of a real gas, with punctual particles, in which all collisions are elastic, with random displacements and with no attractive force between them.

The assumption of the particles being punctual make clear that they do not have size at all. So if they were far apart-relative in their size, they can not collide each other, that is why assumption (B) can not be possible (<u><em>for that particular case</em></u>).

It is clear that (A) is not an assumption for an ideal gas, because do not fit in any of its properties.

Elastic collision: It is a case in which the energy is conserved (Kinetic Energy).

Kinetic Energy: It is the energy that will have an object as a consequence of its movement.

6 0
3 years ago
A car accelerates from rest to 19 m/s in 6 seconds. What is the acceleration of the car?
choli [55]

Answer:

the car is moving so that how it gos so fast

Explanation:

7 0
3 years ago
A body is thrown up with a velocity of 78.4 m per second.How high will it rise and how much time it will take to return to its p
a_sh-v [17]

Answer:

The maximum height reached by the body is 313.6 m

The time to return to its point of projection is 8 s.

Explanation:

Given;

initial velocity of the body, u = 78.4 m/s

at maximum height (h) the final velocity of the body (v) = 0

The following equation is applied to determine the maximum height reached by the body;

v² = u² - 2gh

0 = u² - 2gh

2gh = u²

h = u²/2g

h = (78.4²) / (2 x 9.8)

h = 313.6 m

The time to return to its point of projection is calculated as follows;

at maximum height, the final velocity becomes the initial velocity = 0

h = v + ¹/₂gt²

h = 0 + ¹/₂gt²

h =  ¹/₂gt²

2h = gt²

t² = 2h/g

t = \sqrt{\frac{2h}{g} } \\\\t = \sqrt{\frac{2\times 313.6}{9.8} }\\\\t = 8 \ s

4 0
3 years ago
Other questions:
  • An 30-turn coil has square loops measuring 0.341 m along a side and a resistance of 3.61 Ω. It is placed in a magnetic field tha
    14·1 answer
  • Any science peeps pls help
    15·1 answer
  • A ball is thrown down vertically with an initial speed of 31 ft/s from a height of 40 ft. (a) What is its speed just before it s
    12·1 answer
  • A bicycle pedal is pushed straight downwards by a foot with a 16 Newton force. The shaft of the pedal is 20 cm long. If the shaf
    6·1 answer
  • John owns a used 2003 mustang Mach 1, he spots a news crew with a bunch of people what should he do? A) Rev his engine at the hi
    12·1 answer
  • A torque of 50 Nm is applied to a grinding wheel with moment of inertia 20 kg m2 for 10 s. If it starts from rest, what is the a
    7·1 answer
  • A copper block with a mass of 300 grams is cooled to 77 K by being immersed in liquid nitrogen. The block is then placed in a St
    14·1 answer
  • I need help ASAP plzzzz
    8·1 answer
  • If you break from the speed in part (c) and then start again from rest, how fast will you be able to drive?
    15·1 answer
  • A brick sliding across a smooth floor has a coefficient of static friction of s=0.23 and a coefficient of kinetic friction of k=
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!