Ask Question
28 January, 12:58

What will the following C code print out?

int x = 7, y = 5;

if (x > 5)

if (y > 5)

printf ("x and y are > 5");

else

printf ("x is <=5");

a) "x and y are > 5"

b) "x is <=5"

c) nothing will be printed

+1
Answers (1)
  1. 28 January, 16:53
    0
    x is <=5

    Explanation:

    If-else is the statement that is used to execute the statement when the condition is true.

    syntax:

    if (condition) {

    statement;

    }else{

    statement;

    }

    if we do not provide the curly bracket, still the statement is valid.

    in the question, x = 7 and y=5

    then, check the condition 7 > 5 condition true. it moves to the next if statement and check 5 > 5, condition false. Then it moves to the else part and executes the statement.

    and print the output "x and y are > 5".
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “What will the following C code print out? int x = 7, y = 5; if (x > 5) if (y > 5) printf ("x and y are > 5"); else printf ("x is 5" b) "x is ...” in 📙 Computers & Technology if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers