# I'm having trouble with the challenge for this chapter

I keep getting build failed although I’m copying it exactly the same. What did you guys type?

hi allanl16
i don’t think we are supposed to type in the code, but simply walk through it to answer the question, as per the intro to the chapter.
if you wanted to build and run the program include the code that appears in the challenge inside the opening and closing curly braces below:

[code]#include <stdio.h>

int main(int argc, const char * argv[])
{

}
[/code]
however, i believe the challenge is meant to be more of a mental exercise to exemplify the concepts explained in the chapter.
hope this helps!
mr. magpie

I also have a problem on this challenge.

My understanding is like this:

k is assigned under the following circumstances: if i, which is 20, is bigger than j, which is 25, then k is 10, if not then k is 5. since j is 25 which is bigger than i, this statement is false, thus k is 5. Correct?

Now we enter the if statement:

if 5 is smaller than (j 25 - k 5) then “The first expression is true.” But how come 5 is smaller than 20? So it must be false right, that’s why we have to go to the next else if.

Else if j 25 is bigger than i 20, then “The second expression is true.” j 25 is indeed bigger than i which is only 20. So based on this, my assumption is the correct answer should be “THE SECOND EXPRESSION IS TRUE.” Right? Or am I wrong?

But when I copied the whole thing and run it, the console says “The first expression is true.”

So now I’m confused. Which one of my assumption is wrong? Help please.

Hi tobias.

Your reasoning and conclusion regarding “k” is good: the statement is false, thus k is 5. So YES, that is correct.

Your problem comes next, though, when, despite correctly following the “if” statement, entering “5” as the variable for “k”, and getting the “printf” of “The first expression is true.”, you get befuddled and ask “But how come 5 is smaller than 20?” and then take it a step further and say “it must be false, right?” But it’s NOT false, 5 IS smaller than 20. So it’s not false.

5 is smaller than 20 because it just IS smaller than 20. And because that statement is true, the “first expression is true”, as the printout says. The “else” parts that follow are IGNORED because the first part ( “5 < j - k” ) is true. You’re overthinking it. Once the first part of the if/else clause – the "if part – turns out to be true, then any succeeding “else” portion(s) are ignored.

It’s been a couple of weeks since you asked, so maybe you’ve figured this out by now, but I saw no one else had replied and so have chimed in.

–nooosphere