You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
473 B
26 lines
473 B
namespace ConsoleApp
|
|
{
|
|
internal class AdditionTask
|
|
{
|
|
|
|
private int n;
|
|
private String id;
|
|
|
|
public AdditionTask(string id, int n)
|
|
{
|
|
this.id = id;
|
|
this.n = n;
|
|
}
|
|
|
|
public void Add()
|
|
{
|
|
long sum = 0;
|
|
for (int i = 0; i <= n; i++)
|
|
{
|
|
sum += i;
|
|
}
|
|
Console.WriteLine(id + ": SUM" + n + " -> " + sum);
|
|
}
|
|
|
|
}
|
|
}
|
|
|