Exforsys
+ Reply to Thread
Results 1 to 2 of 2

Print all combinations of 1,2,3 using for loop

This is a discussion on Print all combinations of 1,2,3 using for loop within the C and C++ forums, part of the Programming Talk category; Write a program to print all combinations of 1,2,3 using for loop...

  1. #1
    Martin Lucas is offline Junior Member Array
    Join Date
    Feb 2006
    Answers
    10

    Print all combinations of 1,2,3 using for loop

    Write a program to print all combinations of 1,2,3 using for loop


  2. #2
    lokeshm is offline Member Array
    Join Date
    Apr 2005
    Answers
    83
    Martin, Try this and let me know

    #include <stdio.h>
    main() {
    int a, b, c;
    for (a=1; a<=3; a++) {
    for (b=1; b<=3; b++) {
    for (c=1; c<=3; c++) {
    printf("\n %d %d %d", a, b, c);
    }
    }
    }
    }


Latest Article

Network Security Risk Assessment and Measurement

Read More...