if statement
if statement is the most simple decision-making statement. It is used to decide whether a certain statement or block of statements will be executed or not i.e if a certain condition is true then a block of statement is executed otherwise not.
Syntax:
if(condition)
{
// Statements to execute if
// condition is true
}
Here, the condition after evaluation will be either true or false. C if statement accepts boolean values – if the value is true then it will execute the block of statements below it otherwise not.
Flowchart
1.Write a Program to check user input number is odd Or Even.
#include<stdio.h>
void main()
{
int a;
printf(" Enter the Number=");
scanf("%d",&a);
if ((a%2)==0)
{
printf(" Entered number is Even");
}
if ((a%2)!=0)
{
printf(" Enetred number is odd");
}
}
Output:
0 Comments