jackandryansis7400 jackandryansis7400
  • 14-07-2019
  • Computers and Technology
contestada

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

Respuesta :

PhantomWisdom PhantomWisdom
  • 20-07-2019

Answer:

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".

Answer Link

Otras preguntas

A wooden door costs AED 600 plus a 12% tax. What is the price of the door including the tax?
Given: m∠ADB=m∠CDB, AD ≅ DC Prove: m∠BAC=m∠BCA, MD ⊥ AM
Please help F(-1/2)=1 and f(0)=-4
What will the pressure inside the container become if the piston is moved to the 1.40 L mark while the temperature of the gas is kept constant?
Which revision corrects the error in sentence structure in the paragraph? The land on Earth has not always been separated into the seven continents, at one time
Unit 6 congruent triangles unit test lesson 10 geometry A I’m trying so hard to figure this out and I need to get a good grade on this test.
Match the numbers with the correct label.
my friends comment right now
25. What are the mole ratios for all relationships in the compound Ca2(NO3)2?
Can anyone help me write this essay pls. Essay Purple Heart with 3 of the 7 army values