If else statement in C language
# If else statement in C language
🔺If else statement in C :-The condition is evaluated in if block . If condition is true then statement or set of ststements of " If " block are executed and if condition is false then statement or set of statements of "else" block will be executed .
syntex of if else statement:-
(condition) if
{
//set of statement (true)
}
else
{
//set of statement (false)
}
Example:-
program:-check of odd or even.
#include<stdio.h>
#include<conio.h>
main()
{
int a;
clrscr();
printf("enter any number ");
scanf("%d",&a);
if (a%2==0)
{
printf("%d is even " ,a);
}
else
printf("%d is odd",a);
getch();
}
Output:
enter the number 8
even
enter the number 9
odd
Program;-
Output:-
thank you for reading .......
No comments
Post a Comment