Conditional statements are what drive most programs. They are statements that are determined to be either TRUE or FALSE, and then acted upon based on the result. The most basic of the statements is the if statement.       TRUE and FALSE work differently in C than what you might be used to. TRUE statements always end up equaling a nonzero number. When you perform comparisons, if the result is TRUE then a "1" is returned. If the result is FALSE, then a "0" is returned. Understanding this will help you see how IF statements are processed. Conditional statements revolve around the use of mathematical operators that compare values. The following list contains the most commonly used conditional operators.   >   /* greater than */ <   /* less than */ >=  /* greater than or equal to */ <=  /* less than or equal to */ ==  /* equal to */ !=  /* not equal to */     10 > 5 TRUE 6 < 15 TRUE 8 >= 8 TRUE 4 <= 8 TRUE 3 == 3 TRUE 4 != 5 TRUE You can use IF statements to determine what the program should do next after the statement is evaluated. You can combine it with other conditional statements later to create powerful multiple options, but for now write a simple one to get used to them.   #include <stdio.h>  int main() {   if ( 3 < 5 )     printf( "3 is less than 5");     getchar(); } You can build upon IF statements by using ELSE and ELSE IF statements to handle different results. ELSE statements run if the IF statement is FALSE. ELSE IF statements allow you to include multiple IF statements into one code block to handle various cases. See the example program below to see how they interact.   #include <stdio.h>  int main() {   int age;    printf( "Please enter your current age: " );   scanf( "%d", &age );   if ( age <= 12 ) {     printf( "You're just a kid!\n" );   }   else if ( age < 20 ) {     printf( "Being a teenager is pretty great!\n" );   }   else if ( age < 40 ) {     printf( "You're still young at heart!\n" );   }   else {     printf( "With age comes wisdom.\n" );   }   return 0; }    The program takes the input from the user and takes it through the IF statements. If the number satisfies the first statement, then the first printf statement is returned. If it does not satisfy the first statement, it is taken through each ELSE IF statement until it finds one that works. If it doesn't match any of them, it goes through the ELSE statement at the end.
تعلم أساسيات العبارات الشرطية. العوامل الشرطية الأساسية. كتابة جملة IF بسيطة. استخدام ELSE و  ELSE IF.