Posts

Showing posts with the label C Statements

Nested if in C++

Image
  If is a type of condition checking in which a condition turns out to be  true  a block of statements is executed. Syntax: // if base_condition is true // every inside the { } block will be executed if (base_condition) { statement 1............... statement 2 .............. } Example C++ // C++ Program demonstrate // use if-else condition #include <iostream> using namespace std;   int main() {      int a = 7, b = 6;      if (a > b) {          cout << "True" << endl;      } } Output True What is Nested If? When a number of if blocks are present one after another with the same scope (the same scope means under one { } block), then that condition is termed as a Nested if condition. If the first condition is True, we go into the next if condition and the subsequent condition is checked until we get a false condition, and the checking st...