Computer Science
Write programs to find the sum of the following series:
x + x2/2 + x3/3 + …… + xn/n (Input x and n both)
Python
Python Control Flow
41 Likes
Answer
x = int(input("Enter the value of x: "))
n = int(input("Enter the value of n: "))
sum = 0
for i in range(1, n + 1) :
term = x ** i / i
sum += term
print("Sum =", sum)
Output
Enter the value of x: 2
Enter the value of n: 5
Sum = 17.066666666666666
Answered By
21 Likes
Related Questions
Write a program to accept the age of n employees and count the number of persons in the following age group:
(i) 26 - 35
(ii) 36 - 45
(iii) 46 - 55Write programs to print the following shapes:
*
* *
* * *
* *
*Write programs to print the following shapes:
*
* *
* * *
* *
*Write programs to find the sum of the following series:
x - x2/2! + x3/3! - x4/4! + x5/5! - x6/6! (Input x)