Solution# 1: We can try all the permutations using the following code,
#include#include int main() { int A; int B; int C; int count=0; for(A=0;A<=2;A++) { for(B=0;B<=3;B++) { for(C=0;C<=2;C++) { if((A+B+C)==3) { printf("%d%d%d\n", A, B, C); count++; } } } } printf("count = %d\n", count); return 0; }
No comments:
Post a Comment