Task (no malice)

    You need to replace exactly one (any) character in the next line, and so that it compiles and exactly 20 stars are displayed:
    int main() { int i, n = 20; for (i = 0; i < n; i--) { printf("*"); } }

    * This source code was highlighted with Source Code Highlighter.

    For those who “got their hands on the features of C, the task is most likely not difficult; but there are at least 3 solutions, and if you find one, then this is not a reason to relax :) Or maybe you will find another fourth, fifth ..?
    UPD 1 : The first correct solution was proposed by lostmsu , the other two were steck.
    Do not read comments, break your brain!



    UPD 2 : These are the three solutions ( color="white"):
    • The most obvious is int main() { int i, n = 20; for (i = 0; i < n; n--) { printf("*"); } }
    • Not so noticeable - int main() { int i, n = 20; for (i = 0; -i < n; i--) { printf("*"); } }
    • The most beautiful - int main() { int i, n = 20; for (i = 0; i + n; i--) { printf("*"); } }

    Also popular now: