Computer Science, asked by Anonymous, 10 months ago

Write a program to find the following series upto n terms:
0,7,26...

Answers

Answered by Anonymous
3

Answer:

import java.util.*;

public class Series

{

public static void main(String args[ ])

{

Scanner in=new Scanner (System. in);

int a,c,n;

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

n=in.nextInt();

for(a=1;a<=n;a++)

{

c=Math.pow(a,3)-1;

System.out.println("The series is ="+c);

}

}

}

Explanation:

In the given series it is the subtractive result of 1 from the cube of the numbers.

Such that,

(1×1×1)-1

=1-1

= 0

(2×2×2)-1

=8-1

=7

(3×3×3)-1

=27-1

=26

And vice versa.

Similar questions