Computer Science, asked by ethandsbis, 7 months ago

series 2+6+10+14+....+n java program

Answers

Answered by darkghost486
1

Answer:

import java.util.Scanner;

class series

{

public static void main(String args[])

{

Scanner sc=new Scanner(System.in);

System.out.println("Enter number of terms");

int n=sc.nextInt();

int sum=0;

for(int i=2;i<=n;i++)

{

sum=sum+(i+4);

}

System out.println("Sum of series="+sum);

}

}

Similar questions