/*Control Statement:if else statement*/
* Click Here, for Control Statement:-simple if statement
- The if-else Statement:
The if-else statement is a bi-conditional statement. in this statement, if the condition is true then the one part or program is executed otherwise other part of the program is executed.
The syntax of the if-else statement:
if(condition is true)
execute condition is true statement;
else
execute condition is false statement;
The Flowchart of if-else statement:
* Click Here, for Control Statement:-simple if statement
- The if-else Statement:
if(condition is true)
execute condition is true statement;
else
execute condition is false statement;
The Flowchart of if-else statement:
The Example of if-else statement:
#include<stdio.h>
#include<conio.h>
void main()
{
int num;
printf("enter a number less than 5 =");
scanf("%d",&num);
if(num<5)
printf("Good Your input is correct");
else
printf("Oops!! Your input is Incorrect");
getch();
}
Output:
The Example of if-else statement:
#include<stdio.h>
#include<conio.h>
void main()
{
int num;
printf("enter a number less than 5 =");
scanf("%d",&num);
if(num<5)
printf("Good Your input is correct");
else
printf("Oops!! Your input is Incorrect");
getch();
}
Output:
No comments:
Post a Comment