lindajones2268 lindajones2268
  • 02-01-2021
  • Computers and Technology
contestada

Write a program to find the sum of given series: (a) S = 1 + (1/2) + (1/3) + ...... + (1/20)

Respuesta :

Cytokine
Cytokine Cytokine
  • 02-01-2021

total = 0

numerator = 1

denominator = 1

while denominator != 20:

   total += numerator/denominator

   denominator+=1

print(total)

I wrote my code in python 3.8. I hope this helps.

Answer Link

Otras preguntas

Find the missing side length. Leave your answers radical in simplest form. PLEASE HURRY
Solve for x. Leave your answer in simplest radical form.
Discuss the action of sodium with a) Ammonia b) non-metals
Please answer my given question below...
1 A large quantity of fertiliser has been washed into a stream. Decide whether the following 'rise' or 'fall'.a) Concentration of minerals in the water b) Total
Enter the ratio as a fraction: 6ft to 10 inches
why is the article the map that shows that the city vs. country is not our fault line a secondary source?
If, on a particular day, atmospheric pressure is 730 mm of mercury, what is this a) in pascals b) in atmospheres c) in millibars?
A steel cable with Cross Sectional Area 3.00cm² has an elastic limit of 2.40 x 10^8pascals. Find the maximum upward acceleration that can be given a 1200kg elev
(3) Which of the following rulers is not among the rulers of the Parmar dynasty of Mala? (A) Kumarpal B) Bhoj (C) Siyuk (D) Munj​