Ask Question
29 July, 10:45

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

+5
Answers (1)
  1. 29 July, 11:33
    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?
Find 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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers