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

name the important job of the skull
How far is 1.8 miles and 3.6 miles away from the school
How many people can lift a 30g stone?
Perry was going to sell all of his stamp collection to buy a video game. After selling half of them he changed his mind. He then bought fifteen more. How many d
Why is the APR considered the most important factor to be mindful of in a car loan?
Belle’s grandfather lives in a region where the temperature drops below 0°F at night. When Belle visited her grandfather, they hiked up a hill. Belle noticed th
In which of the following situations would paraphrasing be considered both useful and ethical? a. you don't fully understand what the author is saying. b. you
34 laptops out out 116 computers
How did the Russian Revolution impact World War I? The Russians required the Allied Powers to come to their aid to defeat the radical groups. The Russians pulle
As a result of isolationist desires, U.S. Congress __________ the charter to the League of Nations.