Write a program that display all the possible combination of 1, 2 and 3 || C++ program:

Write a program to generate all combinations of 1, 2 and 3 using for loop.

 program to generate all combinations of 1, 2 and 3 using for loop.

C++ programs

program to generate all combinations of 1, 2 and 3 using for loop.c++ program , computer science


Source code:

/* Write a program that display all the possible 
combination of 1, 2 and 3 */
#include <iostream>/*  iostream provides basic
input and output services for C++ programs */
using namespace std;
int main() 
// Th execution of program start with the main function 
{
   // int is the data type
   int i = 1, j = 1, k = 1;
 // initialized variable by assigning the value
   for (i = 1; i <= 3; i++)// for loop
   {
      for (j = 1; j <= 3; j++)
      {
         for (k = 1; k <= 3; k++)
         {      
          cout <<  i <<" "<<j<<" "<<k<<"\n";
        }
      }
   }
    return 0;
}