write a program to display the following series upto 10 terms:
8,13,18.......................................
Answers
Answered by
3
import java.util.*;
public class Series
{
public static void main(String args[])
{
//Scanner class is mandatory for some programs but it is not necessary here because there is no case of taking input
int a=3,b=5,l;
//using for loop to terminate the program
for(l=1;l<=10;l++)
{
//mathematical expression
b=b*l+a;
//visualising the output
System.out.println("The series is"+b);
}
}
}
Answered by
4
//using the utilization process
import java.util.*;
public class Series
{
public static void main(String args)
{
//using scanner class
Scanner in= new Scanner(System.in);
int a=5,b=2,n;
//due to the repeating program using for loop
for(n=2;n<=11;n++)
{
a=a*n-b;
//visualising the output
System.out.println("The series is"+a);
}
}
}
Similar questions