Computer Science, asked by Jas41, 1 year ago

What is the code for if else statement in C language?

Answers

Answered by Róunak
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.
Answered by siddhartharao77
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!

Jas41: Hey,bro you explaim d it really well
Jas41: well if you dont mind can you answer some of my questions from Computer Science?
siddhartharao77: Thanks for the brainliest
Similar questions