What is the code for if else statement in C language?
Answers
Answered by
3
The syntax of an if...else statement in C programming language is −
if(boolean_expression)
{ /* statement(s) will execute if the boolean expression is true */ }
else
{ /* statement(s) will execute if the boolean expression is false */ }
If the Boolean expression evaluates to true, then the if block will be executed, otherwise, the else block will be executed.
if(boolean_expression)
{ /* statement(s) will execute if the boolean expression is true */ }
else
{ /* statement(s) will execute if the boolean expression is false */ }
If the Boolean expression evaluates to true, then the if block will be executed, otherwise, the else block will be executed.
Answered by
2
The syntax for the if..else statement in C:
if (condition or expression)
{
statements;
}
else
{
statements;
}.
Ex: A program to find even and odd number:
void main()
{
int num;
printf("Enter a number");
scanf("%d",&num);
if(num%2 == 0)
{
printf("%d is even", num);
}
else
{
printf('%d is odd", odd);
}
getch();
}
Hope this helps!
if (condition or expression)
{
statements;
}
else
{
statements;
}.
Ex: A program to find even and odd number:
void main()
{
int num;
printf("Enter a number");
scanf("%d",&num);
if(num%2 == 0)
{
printf("%d is even", num);
}
else
{
printf('%d is odd", odd);
}
getch();
}
Hope this helps!
Jas41:
Hey,bro you explaim d it really well
Similar questions