Q:-find the all possible combination of digits ranging 1 to 9 whose sum is 10, no digit should be repeated in any combination. e.g: 1234 127 136 145 19 235 28 37 46

Hi, May this s not an optimised/generalise solution ..But it produces the output as expected The code snippet is as under: Code: #include<stdio.h> int main() { int i,j,k,l,sum; for(i = 1;i<10;i++) { sum = 0; for ( j=i+1 ;j<10; j++) { sum = i+j; if(sum == 10) { printf("%d %d\n",i,j); break; } if(sum > 10) break; for(k=j+1;k<10;k++) { sum = i+j+k; if(sum == 10) { printf("%d %d %d\n",i,j,k); break; } if(sum > 10) break; for ( l=k+1;l<10;l++) { sum = i+j+k+l ; if(sum == 10) { printf("%d %d %d %d \n",i,j,k,l); break; } } } } }