The if statement is simplest form of decision control statement i.e. frequently used in decision making.The syntax of if statement is as follow-:
syntax-:if(condition)
statement;
or
if(condition)
{statement-1;
statement-2;
statement-3;
-
-
-
statement-n;
}
From above syntax if the condition is TRUE,then the statement will execute or a block of statement-1 to statement-n will execute.
Example-:
#include<stdio.h>
#include<conio.h>
main()
{int num=0;
printf("Enter The Value of num");
scanf("%d",&num);
if(num%2==0)
printf("\n %d is an Even Number",num);
getch();
}
output-:Enter The Value of num 30
30 is an Even Number
output-:Enter The Value of num 30
30 is an Even Number
ads
Are techprogramiz blogs beneficial to you
ReplyDelete