if else conditional statement in C
Code snippet on how to if else conditional statement in C
int x = 5;
if (x > 10) {
printf("x is greater than 10");
} else {
printf("x is not greater than 10");
}
This code uses an if-else statement to compare the value of x an integer. First, the value of x is set to 5. Next the if statement checks to see if x is greater than 10. If x is greater than 10, then the code inside the if statement block will be executed, which prints “x is greater than 10” in the console. If x is not greater than 10, then the code inside the else statement block will be executed, which prints “x is not greater than 10” in the console.