Computer Science, asked by sajju7299, 7 months ago

2/a + 3/a² + 4/a³ + 5/a⁴ + ..n

Answers

Answered by RuwaisnZaid
0

Explanation:

This expression in Python

n = int(input ("Enter n no"))

for i in range(2,n+1):

v = i/math.pow(a,i-1)

print(v)

Answered by anindyaadhikari13
1

Question:-

Write a program to print the sum of the series.

2/a+3/a²+4/a³+....

Program:-

This is written in java.

import java.util.*;

class Sum

{

public static void main(String args[])

{

Scanner sc=new Scanner(System.in);

System.out.print("Enter the value of a: ");

int a=sc.nextInt();

System.out.print("Enter the value of n: ");

int n=sc.nextInt();

double s=0.0;

if(a!=0)

{

for(int i=1;i<=n;i++)

s+=(i+1)/Math.pow(a, i);

System.out.println("Sum of the series is: "+s);

}

else

System.out.println("Invalid Input... ");

}

}

Similar questions