If Statement In C Programming

Posted on

If Assertion

if-then Assertion

 

if-then is most elementary assertion of Choice making assertion. It tells to program to execute a sure a part of code provided that explicit situation or check is true.

Syntax

Instance

Output

if statement - If Statement In C Programming

  • Setting up the physique of “if” assertion is all the time elective, Create the physique once we are having a number of statements.
  • For a single assertion, it’s not required to specify the physique.
  • If the physique will not be specified, then robotically situation half might be terminated with subsequent semicolon ( ; ).

else

It’s a key phrase, through the use of this key phrase we will create a different block for “if” half. Utilizing else is all the time elective i.e, it’s endorsed to make use of once we are having alternate block of situation.

In any program amongst if and else just one block might be executed. When if situation is fake then else half might be executed, if half is executed then robotically else half might be ignored.

Syntax

Instance

Output