// This is my first C language program
#include <stdio.h>
int main(void) {
int n = 0;
int i = 0;
int s = 0;
printf("Please enter value for N\n");
s = 0;
for (i = 1; i <= n; i = i + 1) {
if (i % 2 == 0) {
s = s + i;
printf("Current value i=%d S=%d\n", i
, s
); }
}
printf("Final result suma is S=%d", s
); return 0;
}
Ly8gVGhpcyBpcyBteSBmaXJzdCBDIGxhbmd1YWdlIHByb2dyYW0KI2luY2x1ZGUgPHN0ZGlvLmg+CgppbnQgbWFpbih2b2lkKSB7CiAgICBpbnQgbiA9IDA7CiAgICBpbnQgaSA9IDA7CiAgICBpbnQgcyA9IDA7CgogICAgcHJpbnRmKCJQbGVhc2UgZW50ZXIgdmFsdWUgZm9yIE5cbiIpOwogICAgc2NhbmYoIiVkIiwgJm4pOwoKICAgIHMgPSAwOwogICAgZm9yIChpID0gMTsgaSA8PSBuOyBpID0gaSArIDEpIHsKICAgICAgICBpZiAoaSAlIDIgPT0gMCkgewogICAgICAgICAgICBzID0gcyArIGk7CiAgICAgICAgICAgIHByaW50ZigiQ3VycmVudCB2YWx1ZSBpPSVkIFM9JWRcbiIsIGksIHMpOwogICAgICAgIH0KICAgIH0KCiAgICBwcmludGYoIkZpbmFsIHJlc3VsdCBzdW1hIGlzIFM9JWQiLCBzKTsKICAgIHJldHVybiAwOwp9Cg==