using System;
public class MyLab
{
public static void Main()
{
int n = 0; int i = 0; int s = 0;
Console.WriteLine("Please enter value for N\n");
n = int.Parse(Console.ReadLine());
s = 0;
for (i = 1; i <= n; i += 1)
{
if (i % 2 == 0)
{
s = s + i;
Console.WriteLine("Current value i=" + i + " S=" + s);
}
}
Console.WriteLine("Final result suma is S=" + s);
}
}
dXNpbmcgU3lzdGVtOwoKcHVibGljIGNsYXNzIE15TGFiIAp7CiAgICBwdWJsaWMgc3RhdGljIHZvaWQgTWFpbigpIAp7CiAgICAgICAgaW50IG4gPSAwOyAgICAgaW50IGkgPSAwOyAgICAgIGludCBzID0gMDsKICAgICAgICAKICAgICAgICBDb25zb2xlLldyaXRlTGluZSgiUGxlYXNlIGVudGVyIHZhbHVlIGZvciBOXG4iKTsKICAgICAgICBuID0gaW50LlBhcnNlKENvbnNvbGUuUmVhZExpbmUoKSk7CiAgICAgICAgCiAgICAgICAgcyA9IDA7CiAgICAgICAgZm9yIChpID0gMTsgaSA8PSBuOyBpICs9IDEpIAogICB7CiAgICAgICAgICAgIGlmIChpICUgMiA9PSAwKSAKICAgewogICAgICAgICAgICAgICAgcyA9IHMgKyBpOwogICAgICAgICAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIkN1cnJlbnQgdmFsdWUgaT0iICsgaSArICIgUz0iICsgcyk7CiAgICAgICAgICAgIH0KICAgICAgICB9CiAgICAgICAgCiAgICAgICAgQ29uc29sZS5Xcml0ZUxpbmUoIkZpbmFsIHJlc3VsdCBzdW1hIGlzIFM9IiArIHMpOwogICAgfQp9