if Statement in C - if Statement in C Program



 if Statement in C Program

Learn c - c tutorial - if Statement in C Program - c examples - c programs

if Statement in C Program

  • if statement to execute a block of statements only a given condition is true and the ability to control the flow of program, holding it make decisions on what code to execute, is valuable to the programmer.
  • The if statement allows to control if a program enters a section of code or not based on whether a given condition is true or false.

Sample Code

#include <stdio.h>
int main()
{
    int a=10;
    int b=-10;
    int c=0;
    if(a==10)
        printf("First condition is true\n");
    if(b)
        printf("Second condition is true\n");
    if(c)
        printf("Third condition is true\n");
    return 0;
}

Output

First condition is true
Second condition is true

View More Quick Examples


Related Searches to if Statement in C - if Statement in C Program