What is the output of the program: nested while loop and tenary operator - C++ Statement

C++ examples for Statement:while

Description

What is the output of the program: nested while loop and tenary operator

Demo Code

#include <iostream>
using namespace std;

int main() {//from w  ww .  jav  a 2  s .  c  o  m
   unsigned int row{10};

   while (row >= 1) {
      unsigned int column{1};

      while (column <= 10) {
         cout << (row % 2 == 1 ? "<" : ">");
         ++column;
      }

      --row;
      cout << endl;
   } 
}

Result


Related Tutorials