0% found this document useful (0 votes)
58 views1 page

User Input

The document is code that checks if a user-input number is prime. It uses a for loop to check if the number is evenly divisible by any number from 2 to half the input number. If a match is found, it outputs that the number is not prime, otherwise it is prime.

Uploaded by

Uday Kiran
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
58 views1 page

User Input

The document is code that checks if a user-input number is prime. It uses a for loop to check if the number is evenly divisible by any number from 2 to half the input number. If a match is found, it outputs that the number is not prime, otherwise it is prime.

Uploaded by

Uday Kiran
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

userInput = Inputbox ("Enter any number")

for i = 2 to userInput/2
If userInput Mod i = 0 Then
flag = 1
Exit for
End If
i=i+1
Next
If flag = 1 Then
Msgbox userInput & " is not a Prime number"
Else
Msgbox userInput & " is a Prime number"
End If

You might also like