Could Anybody tell me VBScript for
Check if a given number is Prime number-Don't use any Built-
in Functions Boolean/int is Prime(int number).. Thanks in
advance.
Answer Posted / pankaja yathindrakumar
' Script to find if the given number is Prime or Not
Function Prime(n)
If n<=1 Then
Exit Function
Else
Flag="Prime"
For i=2 To n-1
If n Mod i=0 Then
Flag ="Not Prime"
End If
Next
End if
Prime=Flag
End Function
Res=Prime(6)
MsgBox Res
Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Explain some uses of vb script?
Write a code to print numbers from 5 to 0?
Explain few date functions in vbscript?
What is the use of option explicit statement?
Mention what is variant in vbscript?
Mention what is the use of option explicit in vbscript?
What is vbscript?
When does ‘on click of button’ event gets triggered in the vbscript language?
Why to use option explicit in vb script?
how to automatically update the sql server2005 database records when insert in vb6?
Mention the rules for using option explicit statement?
Explain a few date functions in vbscript
Explain different types of segment?
What is the technology used by vb script?
Which function is used to perform string comparison?