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

The data represent the ages of people working at a store. 19, 27, 20, 26, 20, 24, 32, 23, 20, 19, 21 What is the first quartile of these ages?
The positive integer x is a multiple of 9 and also a multiple of 12. The smallest possible value of x is (A) 3 (B) 12 (C) 21 (D) 36 (E) 72
What is the factor of (2ab)(-5ab)
Explain why the gravitational acceleration of any object near earth is the same matter what was the mass of the object
Consider the relation {(–4, 3), (–1, 0), (0, –2), (2, 1), (4, 3)}.Graph the relation.State the domain of the relation.State the range of the relation.Is
A hiking club has 9 members. How many ways can they choose a president, vice president, secretary, and treasurer from among the members?
How far away is Canopus in kilometres?
What is the answer to split 56 in the ratio of 3:4
What are preventable injuries and unpreventable injuries
Add the following fractions.3/8 + 5/12 =