xxxxxxxxxx
if(raining == 0 || (windSpeed > 15 && temperature < 10))// ** missing if statement **
{
printf("Stay indoors.\n");
}
else
{
printf("You can go outside.\n");
}
return 0;
}
xxxxxxxxxx
if (test expression) {
// run code if test expression is true
}
else {
// run code if test expression is false
}
xxxxxxxxxx
if ( TRUE ) {
/* Execute these statements if TRUE */
}
else {
/* Execute these statements if FALSE */
}
xxxxxxxxxx
if ( TRUE ) {
/* Execute these statements if TRUE */
}
else {
/* Execute these statements if FALSE */
}
xxxxxxxxxx
// C program to illustrate nested-if statement
#include <stdio.h>
int main() {
int i = 20;
if (i == 10)
printf("i is 10");
else if (i == 15)
printf("i is 15");
else if (i == 20)
printf("i is 20");
else
printf("i is not present");
}
xxxxxxxxxx
if ( condition to be checked) {
Statements-if-condition-true ;
}
else{
statements-if-condition-false ;
}
xxxxxxxxxx
#include <stdio.h>
int main() {
char character;
/*
* Take a character as input from user
*/
printf("Enter a Character\n");
scanf("%c", &character);
if((character >= 'a' && character <= 'z')||(character >= 'A' && character <= 'Z')){
printf("%c is an Alphabet\n", character);
} else {
printf("%c is Not an Alphabet\n", character);
}
return 0;
}