Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,25 @@
|
|||
' Babbage problem
|
||||
' The quote (') means a comment
|
||||
' The equals sign (=) means assign
|
||||
n = 500
|
||||
' 500 is stored in variable n*n
|
||||
' 500 because 500*500=250000 less than 269696
|
||||
|
||||
' The nitty-gritty is in the 3 lines between "While" and "EndWhile".
|
||||
' So, we start with 500, n is being incremented by 1 at each round
|
||||
' while its square (n*n) (* means multiplication) does not have
|
||||
' a remainder (function Math.Remainder) of 269696 when divided by one million.
|
||||
' This means that the loop will stop when the smallest positive integer
|
||||
' whose square ends in 269696
|
||||
' is found and stored in n.
|
||||
' (<>) means "not equal to"
|
||||
While Math.Remainder( n*n , 1000000 ) <> 269696
|
||||
n = n + 1
|
||||
EndWhile
|
||||
|
||||
' (TextWindow.WriteLine) displays the string to the monitor
|
||||
' (+) concatenates strings or variables to be displayed
|
||||
TextWindow.WriteLine("The smallest positive integer whose square ends in 269696 is " + (n) + ".")
|
||||
TextWindow.WriteLine("Its square is " + (n*n) + ".")
|
||||
|
||||
' End of Program.
|
||||
Loading…
Add table
Add a link
Reference in a new issue