write a program in visual basics to check whether a number is prime or not
Answers
Answer:
Private Sub btnCheckIt_Click()
isprime = "The Number is Prime"
notprime = "The Number is not Prime"
primeness = True
For x = 2 To Sqr(N)
If N / x = Int(N / x) Then primeness = False: Exit For
Next
Status = IIf(primeness, isprime, notprime)
End Sub
Explanation:
Private Sub btnCheckIt_Click()
Private Sub btnCheckIt_Click()isprime = "The Number is Prime"
Private Sub btnCheckIt_Click()isprime = "The Number is Prime"notprime = "The Number is not Prime"
Private Sub btnCheckIt_Click()isprime = "The Number is Prime"notprime = "The Number is not Prime"primeness = True.
Private Sub btnCheckIt_Click()isprime = "The Number is Prime"notprime = "The Number is not Prime"primeness = True.For x = 2 To Sqr(N)
Private Sub btnCheckIt_Click()isprime = "The Number is Prime"notprime = "The Number is not Prime"primeness = True.For x = 2 To Sqr(N)If N / x = Int(N / x) Then primeness = False: Exit For.
Private Sub btnCheckIt_Click()isprime = "The Number is Prime"notprime = "The Number is not Prime"primeness = True.For x = 2 To Sqr(N)If N / x = Int(N / x) Then primeness = False: Exit For.Next.
Private Sub btnCheckIt_Click()isprime = "The Number is Prime"notprime = "The Number is not Prime"primeness = True.For x = 2 To Sqr(N)If N / x = Int(N / x) Then primeness = False: Exit For.Next.Status = IIf(primeness, isprime, notprime)