This commit is contained in:
nik
2025-09-30 14:26:54 +03:00
parent 8bd93df2ae
commit 8164e04835
633 changed files with 8 additions and 8 deletions

View File

@@ -0,0 +1,23 @@
using System;
class ArithmeticProgression : Progression
{
private int a0;
private int b;
public ArithmeticProgression(int a0, int b)
{
this.a0 = a0;
this.b = b;
}
public override int GetElement(int k)
{
return a0 + (k - 1) * b;
}
public override int Sum(int n)
{
return (2 * a0 + (n - 1) * b) * n / 2;
}
}