Syantax :
if(condition)
{
statement1;
statement2;
.
.
.
statement n;
}
else
{
statement1;
statement2;
.
.
.
statement n;
}
if(condition)
{
statement1;
statement2;
.
.
.
statement n;
}
else
{
statement1;
statement2;
.
.
.
statement n;
}
Program :
#include
void main()
{
int num;
printf(" <<< c program to implement simple if-else >>>\n\n");
printf("\n Enter the number: ");
scanf("%d",&num);
if(num%2==0)
{
printf("\n Entered number is Even Number \n");
}
else
{
printf("\n Entered number is Odd Number \n\n");
}
}
Output :
No comments:
Post a Comment