Menu

Do You Know What Is Your Lucky Number

Programs
Anonymous
2016-08-08
2019-05-29
  • Anonymous

    Anonymous - 2016-08-08

    '@rahimbigbana (beginners).
    'i want my mobilephone show me
    'how many number between 0 to
    '9999 can give sum of 23 and what
    'number it is because i want to buy
    'this 4 digit number at the Magnum
    'lottery counter maybe 1 number
    'just for fun.
    'The result can found at 4d88.com
    'i never buy, bro.
    'let start coding on your android...

    cls

    print color(33)
    cnt=0
    kol=1
    row=1

    for a=0 to 9
    for b=0 to 9
    for c=0 to 9
    for d=0 to 9

    ' i choose single number abcd
    ' flush aabc abbc abcc aaab...

    if a+b+c+d=23 then
    if a=b or b=c or c=d or d=a or a=c or a=d or b=d then
    goto skip
    endif

    cnt=cnt+1
    print at(row,kol);a;b;c;d
    kol=kol+5

    if kol=31 then
    kol=1
    row=row+1

    if row=22 then
    input a$
    cls
    row=1
    endif

    endif
    skip:
    endif

    next d
    next c
    next b
    next a
    print "Grand Total: "; cnt

    'its work! top secret is broken now!
    'Oh my god, 240/10000 how to choose..
    'any idea to improve my code, please tell me.
    'thanks.

     
  • Yet Another Troll

    I don't do very pretty output, but here's my take. There are ten unique solutions, each with FACT(4) ways to arrange them.

    Program Magnum
     Clr Count%
     For i1% = 0 To 9
      For i2% = 0 To 9
       If (i2% <> i1%) Then
        For i3% = 0 To 9
         If (i3% <> i1%) And (i3% <> i2%) Then
          For i4% = 0 To 9
           If (i4% = i1%) Or (i4% = i2%) Or (i4% = i3%) Then
            ! No-op
           Else If (i1% + i2% + i3% + i4%) <> 23 Then
            ! No-op
           Else If (i1% < i2%) And (i2% < i3%) And (i3% < i4%) Then
            Inc Count%
            Print Count%, i1%, i2%, i3%, i4%
            If (Count% Mod 20) = 0 Then
             Pause 5
            EndIf
           EndIf
          Next i4%
         EndIf
        Next i3%
       EndIf
      Next i2%
     Next i1%
     Print Count%; " found."
     Print "OK"
    End
    
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.