// JavaScript program to find the sum of arithmetic series
// Function to find the sum of arithmetic series
function sumOfArithmeticSeries(firstTerm, commonDifference, noOfTerms) {
var result = 0;
for (let i=0; i<noOfTerms; i++)
{
result = result + firstTerm;
firstTerm = firstTerm + commonDifference;
}
return result;
}
var firstTerm = 1;
var commonDifference = 2;
var noOfTerms = 5;
document.write("First Term: " + firstTerm + "<br>");
document.write("Common Difference: " + commonDifference + "<br>");
document.write("Number of Terms: " + noOfTerms + "<br>");
document.write("Sum of the arithmetic series: " + sumOfArithmeticSeries(firstTerm, commonDifference, noOfTerms));