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

K=A+32 solve for Variable A
a spider is crawling on a wall. first it crawls 1 meter up, then 1 meter to the left , and then 1 meter down. what is its total displacement?
Which of the following individuals is a well-known Shaman or tribal elder?
PLEASE HELP ME I AM STUCK PLEASE PLEASE PLEASE
if you increase the force on a box, it will have...
What are the two most reactive groups of elements in the periodic table?
What was the goal of the Sugar Act of 1764 and the Stamp Act of 1765? to limit trade between the colonies and other nations to demonstrate British authority in
What is the next odd number after 7006?
Which of the following was true of Nixon's presidency? A. It oversaw the establishment of the Environmental Protection Agency. B. It tried to overthrow Johns
What happened during the first decade of the 1800's that caused increasing tensions with Native Americans.