Genrate all possible combination of 1,2,3 | C-Program

All Combination of 1 , 2 and 3 :

Tips:

1. Take int three variable.
2.For loop nesting is required.
3.Use if condition. 
3.Then, execute. 

Code:

#include<stdio.h>

void main()

{
    int i,j,k;

    for(i=1;i<=3;i++)

    {
        for(j=1;j<=3;j++)

        {
            for(k=1;k<=3;k++)

            if(i!=j&&j!=k)

            printf("%d%d%d\n",i,j,k);
        }
    }
}

Output:

Comments

Popular posts from this blog

TOP 10 PROGRAMMING LANGAUAGES COMMING 2021 | ARTICLE

Write a C-program to swap two number:

Print Fibonacci Series using Recursion | C program :