C Program for Combinations

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

Questions by vrijesh28

Showing Answers 1 - 2 of 2 Answers

sjulian

  • Feb 20th, 2008
 

int main ()
{
  int i,j,k;

  for(i=1;i<4;i++)
  {
    for(j=1;j<4;j++)
    {
      for(k=1;k<4;k++)
      {
        if((i!=j) && (j!=k) && (i!=k))
        {
          printf("%d%d%dn",i,j,k);
        }
      }
    }
  }
}

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions