Flowchart of if else statement
main()
{
int num;
printf("\nEnter a number to check ");
scanf("%d",&num);
if(num<0 nbsp="" stdio.h="">0>
printf("\nNumber=%d",num);
printf("\nThe if statement in C programming is easy.");
}
In the last program the test expression is number%2==0, if it is evaluated to true then the body of if i.e. Number is even will be processed otherwise it prints Number is odd.
Flowchart of if statement:
In case if statement, the condition will be evaluated, if it is true it executes the statement/s. Whether the condition is true or false the statement/s written after the if statement will be always executed.
Example: To check the number is zero.
#include
Comments
Post a Comment