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,
4 months ago
Physics,
4 months ago
English,
8 months ago
India Languages,
8 months ago
English,
1 year ago
Physics,
1 year ago
Biology,
1 year ago