We can use a For Next Loop or Do While Loop to check whether a number given is a prime number or not in VB Script. The challenge lies in writing a VB script without using any built in functions of VB Script.
Method 1
a = cint(Inputbox("Enter a number to check whether it is a prime number or not"))
count = 0
b = 1
Do while b<=a
aaaif a mod b = 0 Then
aaaaaacount = count +1
aaaEnd If
b=b+1
Loop
If count = 2 Then
aaamsgbox "The number "&a& " is a prime number"
Else
aaamsgbox "The number "&a& " is not a prime number"
End if
Method 2
6 comments:
Superb.Excellent articles for learning sql...........
Very nice reall
dear frnds i need domain knowledge about life insurance in detail regarding interview ...help me plz
@ Siddu: I work in Insurance domain and in an interview you might be asked about the way the policy is created. How the administrative work is carried our. How does the underwriter decides the premium for a customer like based on the risks they want on the policy etc. You can google it. In the mean time if i find some details would post it.
can anyone tell me why b=b+1 stat. is present there in dat while loop???
can you please post the code to find out the list of prime numbers in the given number for example 1 to 100
all the prime numbers should display
Post a Comment