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

What is square root of 126 + square root of 56 in standard form
In 1940 What was Germany’s initial strategy for conquering Britain?
If -2(3y+5)=-4, find the value of 5y
Which of the following did NOT grow or increase as a result of early farming? villages trade life spans cities
How do three planes intersect at one point?
help me the area of a rectangular roof of a doghouse is 756 square inches. the length of the roof is 108 inches. how many inches wide is the roof? show the math
how come some girls don't get period cramps?
A crime suspect fled the scene when police officers entered the building. How far could he run in 10 minutes if he can run 5 miles per hour?
Explain how you would use a number line to find 6+(-8)
Who were the British allies and how did they help them to win so many battles in the American Revolutionary