Posted By

Jammie on 08/28/09


Tagged


Versions (?)

Project Euler Problem 4


 / Published in: Visual Basic
 

  1. Module Module1
  2.  
  3. Sub Main()
  4. Dim Num1 As Integer
  5. Dim Num2 As Integer
  6. Dim product As ULong
  7. Dim productstring As String
  8. Dim counter1 As Integer
  9. Dim counter2 As Integer
  10. Dim answer As ULong
  11.  
  12. Num1 = 999
  13. Num2 = 999
  14. answer = 0
  15.  
  16. For counter1 = Num1 To 100 Step -1
  17. For counter2 = Num2 To 100 Step -1
  18. product = counter1 * counter2
  19. productstring = Convert.ToString(product)
  20. If productstring = StrReverse(productstring) Then
  21. If product > answer Then
  22. answer = product
  23. End If
  24. End If
  25. Next
  26. Next
  27.  
  28. Console.WriteLine(answer)
  29. Console.ReadLine()
  30.  
  31. End Sub
  32.  
  33. End Module

Report this snippet  

You need to login to post a comment.