114
dotPy
7y

Master Coder Unlocked!

Comments
  • 45
    static void printTo100(int step) {
    System.out.println(step);
    int failsAt100 = 1/ (100 - step);
    printTo100(step+1);
    }
  • 69
    System.out.println("1 through 100");
  • 1
    @danielspaniol nice!
  • 2
    @danielspaniol. I was thinking recursion was the obvious solution myself
    Never said it couldn't crash 😂😂😂
  • 4
    @danielspaniol I'd additionally wrap it in a `try { ... } catch(Exception e) {}` block.
  • 4
    This question clearly shows what stupid shit Quora has turned into

    😤
  • 2
    void printnum(uint max)
    {
    If (max > 0)
    printnum(max-1);
    cout << max << endl;
    }

    And call a printnum(100);
  • 4
    @CodaKairos ERR: requirement not met
    Requirement 'no conditions' violated by 'if' keyword
  • 2
  • 2
    @CodaKairos there is still a condition in there. A shortend one but still not right ;)
  • 1
    `X ? Y : Z` is just a short form for `if (X) { Y } else { Z }` so again, there's a condition.
  • 1
    @Jop- what they said, concerning the ternary.

    Correct, for taking the requirement literally 😂😂
  • 2
    @Jop- syntax error, you missed the closing " ;)
  • 2
    @xsacha or is it System.out.println("1 through 100 without any loops or conditions")

    Hmm?
Add Comment