if-else





IF..else CONDITION

if...else statement is used to execute one group of statement.If the boolen value is equal to true then, the if statement is execute . Otherwise the Else statement will be execute



Syntax

if(condition)
{
   true-statement
}
else
{
   false-statement
}



Flow chart for if...else



Example for if...else condition in[c-program]


#include< stdio.h >           /* header file */
#include< conio.h >           /* header file */

void main()                   /* main function start*/
{
int a=10,b=5;                 /*declaring a value*/

clrscr();
printf("the value of a is %d",a);
printf("\n the value of b is %d",b);

if(a>b)                       /* condition*/
{                             /*true statement*/
   printf("\n \n a is big and b is small\n");
}
else                          /*false statement*/
{
   printf("\n \n b is big and a is small\n");
}

getch();
}




youtube tutorial


Comments

Popular posts from this blog

operators in c program

nested-if

switch-statement