229k views
3 votes
Which statement correctly tests int variable var to be less than 0 or more than 50?

User Irena
by
6.5k points

1 Answer

2 votes

Answer:

if-else statement.

Step-by-step explanation:

if-else is the conditional statement that can be used for checking the condition.

Syntax of if-else statement:

if(condition){

statement;

}else{

statement;

}

if the condition put in the if part is TRUE, then the statement inside the if will execute. if the condition put in the if part is FALSE, then the else part will execute.

In the question for testing the variable var is less than or more than 50, if-else statement is best statement.

We can used like that:

if(var<0 || var>50){

printf("Test pass");

}else{

printf("Test failed");

}

User Thibaut Loiseleur
by
6.9k points