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

Which enthalpy change (î"h) is correct for a substance changing from the liquid phase to the solid phase?
Three reasons why health advertisements are or can be deceiving...
A running shoe company wants to reach "avid marathon runners" instead of just "sports fans". which targeting method should this advertiser use?
why did the us rejected the treaty of Versailles
Alex purchased a new car for $28,000. The car's value depreciates 7.25% each year. What will be the value of the car 5 years after it is purchased? Round your a
The genetic code specifies the correlation between what two things
Prove the divisibility of the following numbers: 5^23−5^21 by 24
Why do plants provide bees, butterflies, hummingbirds, and other animals with nectar?
A judge may decide that a case cannot continue on to trial because s/he believes there is no probable cause that an offense was committed. a. True b. False
The wealthy family of florence who were a great power of the city during the renaissance and a big patron of the arts.