Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
VB Script
#1
Solved: 11 Years, 4 Months, 2 Weeks ago
VB script to check a number is prime or not
Reply
#2
Solved: 11 Years, 4 Months, 2 Weeks ago
Code:
For x = 3 To 200 Step 2
      bIsPrime = True
      For y = 2 To x\2
         bIsPrime = x mod y > 0
         If Not bIsPrime Then Exit For
      Next
' check if the bIsPrime returns true if yes then it is prime.
      
  If bIsPrime Then
         document.writeln("Found a prime number: " & x)  
      End If
   Next
[/align]

by the way did you google it?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)