| If, Else If, Else In micocontroller c programming and computer c programming, if statement can be used to test whether a condition is true or false. When a condition is true the statement after it will be executed, otherwise other statement will be executed. Example program : #include <stdio.h> int main() { int b; printf("Enter a value:"); scanf("%d", &b); if (b < 0) {printf("The value is negative\n"); getchar(); getchar(); } else if (b == 0) {printf("The value is zero\n"); getchar(); getchar(); } else {printf("The value is positive\n"); getchar(); getchar(); } return 0; } |