Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

why does the values of int roll02 = 1 not zero on E04 loops challenge?

why this?

int roll01 = 0;

            int roll02 = 1;

            int attempts = 0;


not this

int roll01 = 0;

            int roll02 = 0;

            int attempts = 0;

Best Answer

  • HNJHNJ Member
    Accepted Answer

    Someone asked this before too. If roll01 and roll02 are both equal at start then the condition stating roll01 == roll02 will be True at start the the loop will terminate. Hence the programme will not run.


    They have different values at start so that they are given random values and if eventually both have equal values, loop terminates!

Answers

Sign In or Register to comment.