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 ultimately contributed to the weakening of the Persian Empire?
Which of the following describes the role of cyclic amp (cAMP) in hormone responses
Use words to describe the relationship between corresponding numbers of hours and weeks
Let D = {14,17,19), E = {14,16,17,18) and F = {13,15,16,17,19). List the elements in the set (DuE) n F=
Why did France donate a massive statue to the United states
[tex]A=\frac{1}{2}\pi w^2+2lw[/tex]Solve for L
The sum of 12.6, 31, and 5.4 is greater then 20
please help me please
Simplify the expression: (6 − 2i)(4 − 5i).
-25 Points- If P= (-2,-1) and Q= (-6,-3) are the endpoints of the diameter of a circle, find the equation of the circle.