Write a program to display the following series upto 10 terms:
4,6,8.......................................
Answers
Answered by
5
import java.util.*;
public class Series
{
public static void main(String args[])
{
int a=2,b;
for(b=1;b<=10;b++)
{
a=a*b+2;
System.out.println("Display the series"+a);
}
}
}
Answered by
7
import java.util.*;
public class Series
{
public static void main(String args[])
{
Scanner in=new Scanner(System.in);
int a,b=2,i;
//using for loop
for(i=1;i<=10;i++)
{
//using do while loop
do
{
a=a*i+b;
while
{
a=2;
}
System.out.println("The series is"+a);
}
}
}
}
Similar questions
Science,
6 months ago
Social Sciences,
6 months ago
Math,
6 months ago
English,
1 year ago
Physics,
1 year ago
Political Science,
1 year ago