Write a program to find the sum of the following series upto n terms:
15,90,210......................
no excuse no spam no improper answer!!!!
Answers
Answered by
12
/*We can write the program by using java or c or c++ but java is more advanced so we should use java here and about of utility version*/
import java.util.*;
public class Scanner
{
public static void main(String args[])
{
//since there is need of input so using scanner class
Scanner in=new Scanner(System.in);
int s=0, m=10,n, i;
//declairing the value of n
n= in.nextInt();
//Since the program is terminating one so, using for loop to shorten it
for(i=5;i<=n;i=i+5)
{
//mathematical expression
s=Math.pow(i,2)-m+s;
//Displaying the output
System.out.println("The sum of the series is"+s);
}
}
}
Similar questions