Write a program to find the following series upto n terms:
1, 16, 81....
Answers
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,4);
System.out.println("The series is ="+b);
}
}
}
Explanation:
Since, it is a series of the value to the power 4.
Such that,
(1)^4=1
(2)^4=16
(3)^4=81
And so on.
Write a java program to find the following series upto n terms:
1, 16, 81....
_______________________________________________
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,4);
System.out.println("The series is ="+b);
}
}
}
______________________________________________
Since, it is a series of the value to the power 4.
Such that,
(1)^4=1
(2)^4=16
(3)^4=81
And so on.