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 value of the variable makes the statement true? m + 4 = –2.8 a. –6.8 b. –1.2 c. 1.2 d. 6.8
-x² + 4x - 4 = 0 Solve the equation
Work out 5/8−2/5 Give your answer in its simplest form.
Are the commas in the right place? 894 Jenkins Blvd.,Knoxville, Tennessee 37901 June 12, 2001 Or 894 Jenkins Blvd. Knoxville, Tennessee 37901 June 12,2001
What is the value of the 4 in 6.54
Why Is It Hard For Electrons To Move Through An Insulator
How do the skeletal system and the lymphatic system work together to protect the body from disease?
Write 0.725 as a fraction in its simplest form
Should secret wiretapping be legal
Jason is saving up to buy a digital camera that cost $490. So far he has saved $175. He would like to buy the camera 3 weeks from now. Write an equation and sol