series 2+6+10+14+....+n java program
Answers
Answered by
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
Social Sciences,
3 months ago
English,
7 months ago
India Languages,
7 months ago
English,
11 months ago
Physics,
11 months ago
Biology,
11 months ago