Computer Science, asked by SiRiShA7bTAaRmY, 2 months ago

Design a class to overload a function series() as follows:
i)void series(int x,int n)-to display the sum of the series given below: x^1+x^2+x^3+………..+x^n terms​

Answers

Answered by krishnakantbinar
0

the collection of eight planets and their moons in orbit round the sun, together with smaller bodies in the form of asteroids, meteoroids, and comets. The planets of the solar system are (in order of distance from the sun) Mercury, Venus, Earth, Mars, Jupiter, Saturn, Uranus, and Neptune.

Answered by zayyanmuallim
1

Answer:

{

   void series(int x, int n) {

       long sum = 0;

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

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

       }

       System.out.println("Sum = " + sum);

   }

void series(int p) {

       for (int i = 1; i <= p; i++) {

           int term = (int)(Math.pow(i, 3) - 1);

           System.out.print(term + " ");

       }

       System.out.println();

   }

void series()

{

       double sum = 0.0;

       for (int i = 2; i <= 10; i++) {

           sum += 1.0 / i;

       }

       System.out.println("Sum = " + sum);

   }}

Similar questions