Write a program to display the series upto 10 terms:
2,9,28......................................................
Answers
Answered by
5
import java.util.*;
public class series
{
public static void main(String args[])
{
Scanner in=new Scanner(System.in);
int i,o;
for(i=1;i<=10;i++)
{
o=Math.pow(i,3)-1;
System.out.println("{Display the series"+o);
}
}
}
Answered by
3
import java.util.*;
public class series
{
public static void main(String args[])
{
int a,b;
//using for loop
for(a=1;a<=10;a++)
{
//using mathematical class of java
b=Math.pow(a,3)-1;
System.out.println("{Display the series"+b);
}
}
}
Similar questions