Computer Science, asked by Gohan1920, 11 months ago

Write a program in Java to calculate and print the sum of the following series.
s=x^1+ x^3 + x^5 + x^7 +............x^n
Take necessary inputs from the user​

Answers

Answered by Pragya3918red
1

Explanation:

class Sumseries

{

void input (int n, int x)

{

int s = 0, i ;

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

{

while (i/2 !=0)

{

s = s + Math.pow(x,i);

}

}

System.oit.println(" The sum of the terms is" + s);

}

}

THE PROGRAM IS IN JAVA.

I HOPE THIS ANSWER WILL HELP YOU AND PLEASE MARK THIS ANSWER THE BRAINLIEST ONE...

Similar questions