using System.Collections.Generic;
public static class ArithmeticProgression
public static List<int> GetTerms(int start, int step, int term_count){
var terms = new List<int>();
} while (terms.Count() < term_count);
public static void Main()
Console.WriteLine("Arithmetic Progression in C#\n");
RunDemo(13, 7, 15, false);
RunDemo(133, 74, 45, false);
public static void RunDemo(int start=1, int step=1, int term_count=10, bool showEachTerm = true)
var terms = ArithmeticProgression.GetTerms(start, step, term_count);
var mainSectionStart = "".PadRight(33, '=');
var mainSection = "".PadRight(33, '-');
var subSection = "".PadRight(20, '-');
var subSectionEnd = "".PadRight(20, '=');
$"{mainSectionStart}\n" +
$"- Arithmetic Progression Options:\n" +
$"- Start at:\t\t{start}\n" +
$"- Increase by:\t\t{step}\n" +
$"- Number of Terms:\t{term_count}\n" +
$"- ShowEachTerm:\t{showEachTerm}\n" +
$"- Sum of Terms:\t{terms.Sum()}");
$"- List of Terms:\n{subSection}");
terms.ForEach(term => Console.WriteLine($" {term}"));
Console.WriteLine($"{subSectionEnd}\n\n");