Thank you very much for your help with the lottery program. It works ! I am amazed. I never would have been able to figure this out. This is the first time I have ever reached out to any type of Yahoo Group for help. Unbelievable !!
--- On Fri, 10/31/08, Michael M. Mahoney <catspawsd@...> wrote:
From: Michael M. Mahoney <catspawsd@...>
Subject: [libertybasic] Re: Lottery Program
Date: Friday, October 31, 2008, 11:48
Below is one way to get what I think you want. Notice that each FOR
must have a matching NEXT.
This brute force program will display all of the unique combinations
of 6 numbers between 1 and 54 that add up to 150. No number is
duplicated in an answer.
This will take a while to run, there are 255,772 combinations found,
out of a possible 25,827,165 total combinations.
' BEGIN CODE
' lotto numbers that add to 150
For A = 1 to 49
For B = (A + 1) to 50
For C = (B + 1) to 51
For D = (C + 1) to 52
For E = (D + 1) to 53
For F = (E + 1) to 54
IF A+B+C+D+E+F = 150 then
cnt = cnt + 1
print "There are "; cnt; " combinations that add to 150"
input "Press any key to end..."; a$
--- In libertybasic@ yahoogroups. com, "mdeboth" <mdeboth@... > wrote:
> I am want to write a lottery program. I want a program that gives all
> the mathematical possible cominations where the sum of the digits
> (numbers drawn)add to 150. The lottery draws six numbers ranging from 1
> to 54.
> Below is my attempt to write a program. So much for the book,
> Programing for Dummies.
> For A = 1 to 54
> For B = 1 to 53
> For C = 1 to 52
> For D = 1 to 51
> For E = 1 to 50
> For F = 1 to 49
> IF Print A+B+C+D+E+F = 150 then
> Print A,B,C,D,E,F
> What is wrong ? Help would be very much appreciated.
[Non-text portions of this message have been removed]