write a series java program 1,27,125,343.....?
Answers
Answered by
6
import java.util.*;
class series
{
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter the limit");
int n=sc.nextInt();
int a=1;
for(int i=1;i<=n;i=i+2)
{
a=i*i*i;
System.out.print(i+" , ");
}
}//main
}//class
-------------------------------------------------------------------
OUTPUT :
Enter the limit
4
1,27,125,343
Hope it helps :-)
______________________________________________________________________
Similar questions