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 is the narrator doing to forget his sorrows over losing Lenore? (from TheRaven)a) nappingb) readingc) drinkingd) nothing​
Find the measure of one exterior angle for the following regular polygon.
report on school exhibition of science and art
in a uniform electric field ,the magnitude of the force on a charge of 0.2 coulomb is 10 Newton. Calculate the field intensity​
Mariam went to a shop and bought 8 snickers, 3 galaxy and 3 kitkat. She payed 8 BD totally. Her friend Zainab bought 4 snicker, 9 galaxy and 4 kitkat. She payed
Which paragraph in the excerpt from Amy Tan’s “Rules of the Game” best shows a conflict between two cultures? My mother patted the flour off her hands. "Let me
What is the relation between Genes and DNA?​
If x-2y=10 and y is three times the value of x, What is the value of x-y? a) -8 b) -4 c) 0 d) 2 e)4
Find the value of x if 12x=34^2 - 26^2
........................should not be encouraged in schools (favour ,favourite,favourable,favouritism,favourites)