#include #include int main(void) { int temp, x; printf("What is the temperature? "); scanf("%d", &temp); /* Example 1: single statement to execute */ if (temp >= 20) printf("The temperature is warm\n\n"); else printf("The temperature is cool\n\n"); /* Example 2: use braces to build a compound statement to execute */ if (temp >= 20) { /* open brace */ printf("condition is true, so we execute the _true_ branch\n"); printf("The temperature %d is warm\n", temp); } /* close brace */ else { printf("condition is false, so we execute the _false_ branch\n"); printf("The temperature %d is cool\n", temp); } /* Example 3: use multiple branching */ printf("Enter any integer number =\n"); scanf("%d", &x); if (x > 0) printf("%lf\n", sqrt(x)); else /* either x is 0 or it is negatiuve */ { if (x == 0) printf("Square root of 0 equals 0\n"); else printf("%lf\n", sqrt(-x)); } return(0); }