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

Points A, B, and C are collinear with coordinates A(-2,5), B(1,3), and C (x,-13). What is x?
What is the distance between 120-130 on a number line?
Correct answer please? I can't figure it out
Which two are functions?
According to Dr. Friedman, European monarchs tended to be
Pada gambar berikut ini, titik M adalah titik singgung ruas garis PS pada lingkaran yang berpusat di O. Jika besar ∠ = 20°, maka ∠ = ⋯ °.
global warming leads to rise in the water level . Do you agree ? Prove your statement
nutuk kitabı özet örneği
Lupe insists that whistling backstage is a jinx. Even though Carmen, her director, doesn’t believe in superstitions, she doesn’t correct Lupe. She doesn’t want
Aled feeds his pet cat of a can of cat food each day. How many cans of cat food should Aled buy each week