Computer Science, asked by fthh, 1 year ago

Write a program to find the following series upto n terms:
1,8,27....

Answers

Answered by itzsupercrusher
2

Answer:

import java. util.*;

public class Series

{

public static void main(String args[])

{

Scanner in=new Scanner(System.in);

int n, a,b;

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

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

{

b=Math.pow(a,3);

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

}

}

}

Explanation:

Since, it is a series of cube of the value.

Such that,

(1)^3 =1

(2)^3=8

(3)^3=27

And so on.

Answered by Anonymous
0

Answer:

import java.util.*;

public class Series

{

public static void main (String args[])

{

Scanner in=new Scanner(System.in);

int n, a,b;

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

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

{

b=Math.pow(a,3);

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

}

}

}

Explanation:

Since, it is a series of cube of the value.

Such that,

(1)^3 =1

(2)^3=8

(3)^3=27

And so on.

Similar questions