C compound if statement



Compound If Statement in C Programming :

void main ( )
{
   int num = 10 ;
   if(num > 0)
	{
	printf ("\nNumber is Positive");
	printf ("\nThis is The Example of Compound Statement");
	}
}

Output of Program :

Number is Positive
This is The Example of Compound Statement

Explanation of Compound If Statement :

In C Programming, Any block of the code is written or embedded inside the pair of the curly braces. If condition specified inside the ‘if block’ is true then code block written inside the pair of curly braces will be executed.

printf ("\nNumber is Positive");
printf ("\nThis is The Example of Compound Statement");

[box]Note : We can write any number of statements inside block if condition is true[/box]