Wednesday, April 14, 2010

Script to print Prime Numbers

Click on Back to the Assignment Question Page

Write a script to print prime numbers based on the user input for the prime number limit.

n = Inputbox("Please Enter the limit")
For i = 1 to n
aaaCount = 0
aaaa = 1
aaaaaaDo While a<=i
aaaaaaaaaIf i MOD a = 0 Then
aaaaaaaaaaaaCount = Count + 1
aaaaaaaaaEnd If
aaaaaaa=a+1
aaaaaaLoop
aaaaaaaaaIf Count = 2 Then
aaaaaaaaaaaavar = var&" "&i& ", "
aaaaaaaaaEnd If
Next
aaaMsgBox("Prime numbers within " &n&" numbers = :" &var)

Click on Back to the Assignment Question Page

No comments:

Post a Comment