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
What is the period of a blender blade that spins around 400 times in 5.0s
Murljashka [212]

Answer:

f = 400 / 5 s = 80/sec        frequency of revolution

P = 1/f = 1/(80/sec) = .0125 sec   period of revolution

5 0
2 years ago
A man weighing 180 lbf pushes a block weighing 100 lbf along a horizontal plane. the dynamic coefficient of friction between the
Talja [164]
The first thing you should know is that the work is defined as:
 W = F * d
 Where
 F = force
 d = displacement
 We have then
 (a) the block
 F = (0.2) * (100) = 20
 d = 100
 W = (20) * (100) = 2000 ft.lbf
 (b) the man as the system.
 F = (0.2) * (100 + 180) = 56
 d = 100
 W = (56) * (100) = 5600 ft.lbf
 answer:
 (a) 2000 ft.lbf
 (b) 5600 ft.lbf
3 0
3 years ago
What collides and creates a movement of heat called conduction?
lutik1710 [3]
The answer of this is C!!!
6 0
3 years ago
Name two examples where the cohesive force dominates over the adhesive force and vice versa​
lidiya [134]
Attractive forces between molecules of the same type are called cohesive forces. ... Attractive forces between molecules of different types are called adhesive forces. Such forces cause liquid drops to cling to window panes, for example.
5 0
2 years ago
The 26-kg sphere c is released from rest when θ = 0∘ and the tension in the spring is f = 100 n
aleksandr82 [10.1K]
You are given the mass of a sphere that is 26 kg sphere and it is released from rest when θ = 0°. You are also given the force of the spring that is F = 100 N. You are asked to find the tension of the spring. Imagine that the sphere is connected to a spring. The spring exerts a tension and the spring exerts gravitational pull. This will follow the second law of newton.

T - F = ma
T = ma + F
T = 26kg (9.81m/s²) + 100 N
T = 355.06 N

5 0
3 years ago
Other questions:
  • If the slope of a line on a speed-time graph is 0 and it is not on the x-axis, what is the object doing?
    9·1 answer
  • You riding in a car traveling at a speed of 73 mi/hr in a. 60 mi/hr zone, when suddenly you spot a police car parked 20 ft ahead
    15·2 answers
  • Why do concave lenses always form virtual images?
    11·2 answers
  • If a sprinter’s mass is 60 kg, how much forward force must be exerted on the sprinter to make the sprinter accelerate at 0.8 m/s
    12·2 answers
  • Helium has a density of 1.79 x 10-4 g/mL at standard temperature and pressure. A balloon has a volume of 6.3 liters. Calculate t
    9·2 answers
  • 12. What does positive and negative acceleration indicate?
    6·1 answer
  • If the color red has a wavelength of 7.0 107 m. its frequency is
    12·2 answers
  • Is<br>pressure<br>and<br>electric<br>charge<br>a vector<br>quantity? Explain.​
    5·1 answer
  • The total amount of kinetic energy and potential energy within a system is called
    11·2 answers
  • A current of 8 A is used to operate a Nespresso coffee machine. Choose the most suitable fuse size from the following
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!