if statement in C language by R4R Team

syntax:

if(condition)
{
body;
}

-Here body will execute if condition is true.

Example-

if(2==2)
{
printf("Yes");
}
//Yes

if(2!=6)
{
printf("Yes")
}
//Nothing



program-

#include< stdio.h>
int main()
{
int a=7;
if(a==7)
{
printf("7n");
}
if(a==1)
{
printf("1n");
}
if(5==5)
{
printf("Yesn");
}
if(2)
{
printf("Yes");
}
}


output-

7
Yes
Yes

-In this program, we make if statement with different condition.
-If condition is true then body of if statement is execute otherwise not execute.




Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!