codeGK
Code it ALL
C++ If Else - CodeGK
♦ C++ If Else

♣ About C++ If Else

if, else statements are known as conditionals in C++.
if, else are calculated upon comparing two same Data Types over operators.

♣ Example1: C++ If

If a particular statement is true, then the block corresponding to that If statement will be executed.
In this example, two numbers are compared.
Example
Input:
Output:

♣ Example2:C++ Else

If all the prior defined statements are false then, the last remaining block which is the else code block will be executed.
In this example, two numbers are compared.
Example
Input:
Output:

♣ Example3: C++ Else-If

"else-if" statement block is executed intermediately between "if" and "else"(at the end), i.e, if the "else-if" statement becomes true after the "if" statement has become false.
In this example, Time is tested.
Example
Input:
Output:
Prev_LessonNext_Lesson
C++ If Else