kryton9
25-02-2010, 09:52
' 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
' 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