diff --git a/.zed/debug.json b/.zed/debug.json new file mode 100644 index 0000000..0e7ebd1 --- /dev/null +++ b/.zed/debug.json @@ -0,0 +1,8 @@ +[ + { + "label": "Debug C", + "program": "$ZED_WORKTREE_ROOT/main", + "request": "launch", + "adapter": "CodeLLDB", + }, +] diff --git a/main.c b/main.c index 911ee78..f356125 100644 --- a/main.c +++ b/main.c @@ -1,25 +1,16 @@ - #include int main(void) { int n; scanf("%d", &n); - int resultof3 = n%3; - int resultof5 = n%5; - if (!resultof5 && !resultof3) { - printf("FizzBuzz"); - } else if (!resultof3) { - printf("Fizz"); - } else if (!resultof5) { - printf("Buzz"); - } else { - printf("%d", n); - } - /* TODO: print exactly one line: - multiple of 3 and 5 -> FizzBuzz - multiple of 3 only -> Fizz - multiple of 5 only -> Buzz - anything else -> the number itself */ + long long result = 0; + long imat = 1; + while (!(imat>n)) { + result = result +imat; + imat = imat+2; + } + + printf("%lld", result); return 0; }