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