Physics, asked by gvghgh, 1 year ago

Write a program to find the series upto 10 terms:
2,7,12.............................

Answers

Answered by Anonymous
4

/*Follow carefully, there is no such case of taking input so we should not use the Scanner class but, Scanner class is necessary while there is any such case of taking input regarding any veriable. Observe the series carefully, 2 then 7 then 12, that is a sequesnce following the multiples of 5, such that,

5*1-3=5-3=2

5*2-3=10-3=7

5*3-3=15-3=12*/

//now come to the program

//using the utilization process

import java.util.*;

public class Series

{

public static void main(String args[])

{

//as Scanner class is not necessary so, we should not use the scanner class in this program because, the program is better which can be competed shortly and it takes less place too.

int a=5,i;

//using for loop to terminate the program again and again

for(i=1;i<=10;i++)

{

a=a*i-3;

//representing the output

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

}

}

}

Similar questions