Loading ...
Sorry, an error occurred while loading the content.

Re: Lotterty Program

Expand Messages
  • Gordon Sweet
    You are welcome to adapt to your needs my Lotteries.bas among the LEISURE zip from http://www.sigord.co.uk/LBcode.htm Gordon [Non-text portions of this
    Message 1 of 6 , Nov 1, 2008
    • 0 Attachment
      You are welcome to adapt to your needs my Lotteries.bas among the LEISURE zip from http://www.sigord.co.uk/LBcode.htm

      Gordon


      [Non-text portions of this message have been removed]
    • Milton DeBoth
      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
      Message 2 of 6 , Nov 1, 2008
      • 0 Attachment
        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
        To: libertybasic@yahoogroups.com
        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
        Print A,B,C,D,E,F
        cnt = cnt + 1
        end if
        next F
        next E
        next D
        next C
        next B
        next A
        [done]
        print
        print "There are "; cnt; " combinations that add to 150"
        print
        input "Press any key to end..."; a$
        end

        'END CODE

        --- 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]
      Your message has been successfully submitted and would be delivered to recipients shortly.