DIM a AS INTEGER, b AS INTEGER, c AS INTEGER, d AS INTEGER, k AS INTEGER OPEN "c:\nosdevoirs\polynome.sol" FOR OUTPUT AS #1 k = 0 FOR a = 1 TO 6 FOR b = 1 TO 6 FOR c = 1 TO 6 FOR d = 1 TO 6 IF a + b + c + d = 9 THEN k = k + 1 PRINT k, a; b; c; d PRINT #1, k, a; b; c; d
What you could do it is. Start adding numbers and once you get close to 6 numbers See if you are close to 51 and switch around the numbers to make it equal 51 hope this helps