Knowledge Walls
Venkatesan
Hyderabad, Andhra Pradesh, India
Passcode:
Introduction [cont'd]
Input Output Functions [cont'd]
Structures and Unions [cont'd]
# Preprocessor [cont'd]
If in Decision Statements of Programming in C
2206 Views
If statement 
Simple IF statement is used to execute particular statements with certain conditions. It controls the flow of statement execution. If given condition is true then the block of statements will get executed.
Syntax 
if (condition or expression)
{
    statements;
}
IF example
#include
//To check given no is even number
void main(){
    int num;
    printf("Enter a number to check given number is even\n");
    scanf("%d",&num);
    if ((num % 2) == 0){
        printf("Given Number is even:%d",num);
    }
}
Output 
Enter a number to check given number is even
12

Given Number is even:12
Next Topics
Next lessons of current book.
Decision Statements of Programming in C
Decision Statements of Programming in C
Decision Statements of Programming in C
Decision Statements of Programming in C
Decision Statements of Programming in C
Previous Topics
Previous lessons of current book.
Input Output Functions of Programming in C
Input Output Functions of Programming in C
Input Output Functions of Programming in C
Input Output Functions of Programming in C
Input Output Functions of Programming in C
Best Lessons of "Programming in C"
Top lessons which are viewed more times.
Structures and Unions of Programming in C
Input Output Functions of Programming in C
Structures and Unions of Programming in C
  Copyright © 2014 Knowledge walls, All rights reserved
KnowledgeWalls
keep your tutorials and learnings with KnowledgeWalls. Don't lose your learnings hereafter. Save and revise it whenever required.
Click here for more details