Syntax: if(condition)
{
Block-I statements
}
else
{
Block-II statements
}
Statements-z;
Ø First condition is
evaluated. It produces either TRUE or
FALSE.
Ø If the condition is True,
then compiler executes the Block-I statements and then it reaches to
statements-z
Ø If the condition is False,
then compiler executes the Block-II statements and then it reaches to
statements-z
/* MAXIMUM
OF TWO NUMBERS */
#include<stdio.h>
#include<conio.h>
main()
{
int a=20,b=10;
clrscr();
if(a>b)
printf("The largest value is %d
",a);
else
printf("The largest value is %d
",b);
getch();
}
No comments:
Post a Comment