Results 1 to 1 of 1

Thread: Example: Section 3.2 (page 14), Super-3 Numbers

  1. #1
    thinBasic MVPs kryton9's Avatar
    Join Date
    Nov 2006
    Location
    Naples, Florida & Duluth, Georgia
    Age
    68
    Posts
    3,865
    Rep Power
    405

    Example: Section 3.2 (page 14), Super-3 Numbers

    [code=thinbasic]' Example 3.2 Super-3 Numbers

    ' From Stan Blank's Book:
    ' "Python Programming in OpenGL
    ' "A Graphical Approach to Programming

    ' Converted by Kent Sarikaya
    ' Last modified: February 25, 2010


    ' Since this is a console app, need to use the Console Module
    ' The string and other features used are part of the core module
    ' so no need to use any other Uses modules
    Uses "Console"

    ' Uncomment the next line if you want to run in fullscreen mode
    'Console_FullScreen()

    ' We can use Aliases in thinBasic
    ' now Input can be used as Console_Read
    Alias Console_Read As Input

    ' The long type was not big enough, so I used quad
    Dim i, n, x As Quad

    Print("Please enter the upper bound: ")
    i = Val(Input())

    For n = 1 To i
    x = 3*n^3
    If InStr(Str$(x),"333") Then PrintL( n + " " + x )
    Next

    Print("Finished - press any key to exit")
    WaitKey


    'Python source code, pg. 14:
    '# Super-3 Numbers
    'import String
    'i = input(“Please enter the upper bound: “)
    'For n In range(i):
    ' x = 3*n**3
    ' If String.find(str(x), “333”) <> -1:
    ' Print n, x
    '# End of program[/code]
    Attached Files Attached Files
    Acer Notebook: Win 10 Home 64 Bit, Core i7-4702MQ @ 2.2Ghz, 12 GB RAM, nVidia GTX 760M and Intel HD 4600
    Raspberry Pi 3: Raspbian OS use for Home Samba Server and Test HTTP Server

Similar Threads

  1. Excercise: #1, Section 3.2 (page 21), Super-D Numbers
    By kryton9 in forum ThinBASIC programming in OpenGL/TBGL
    Replies: 0
    Last Post: 25-02-2010, 10:20

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •