When we need to enter the block only when given condition is true then we use if-statement. means we enter the if block only if given condition is true.
if(condition)
{
.
.
// block of Statements;
}
Above syntax shows the working of if-statement. Which shows when if condition is true then it enters in if's block. Otherwise it goes outside the if block.
Let know more about if-statement with one example:
#include<stdio.h>
void main()
{
int a=15;
if(a>10)
{
printf("a is greater than 10");
}
}
Synatx of if-statement:
if(condition)
{
.
.
// block of Statements;
}
Above syntax shows the working of if-statement. Which shows when if condition is true then it enters in if's block. Otherwise it goes outside the if block.
Let know more about if-statement with one example:
#include<stdio.h>
void main()
{
int a=15;
if(a>10)
{
printf("a is greater than 10");
}
}
No comments:
Post a Comment
If you have any doubts, please discuss here...👇