Write a program to find the following series upto n terms:
0,7,26...
Answers
Answered by
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
Accountancy,
5 months ago
Physics,
5 months ago
Geography,
5 months ago
Computer Science,
10 months ago
Computer Science,
10 months ago
Math,
1 year ago