answered By Hitesh-1047 0

'VBScript program to display the prime numbers PrimeNumberLimit = inputbox("Enter the range till (ex: 50):") 'Getting the limit as an input from the user

PrimeNumberList="Prime number list is:" 'Initialising the list of prime numbers

For Ctr1=1 to PrimeNumberLimit

PrimeFlag=True ' Initialising a Flag variable

If Ctr1>=4 Then

```
For Ctr2=2 to Ctr1/2
If Ctr1 mod Ctr2 = 0 Then 'Checking the reminder
PrimeFlag=False
'Not a prime number
End If
Next
```

End If

If PrimeFlag=True Then

```
PrimeNumberList=PrimeNumberList&" "&Ctr1
'Collecting the prime numbers
```

End If

Next

Msgbox PrimeNumberList 'Displaying the result

flag

answered By Hitesh-1047 0

'VBScript program to display the prime numbers PrimeNumberLimit = inputbox("Enter the range till (ex: 50):") 'Getting the limit as an input from the user

PrimeNumberList="Prime number list is:" 'Initialising the list of prime numbers

For Ctr1=1 to PrimeNumberLimit

PrimeFlag=True ' Initialising a Flag variable

If Ctr1>=4 Then

```
For Ctr2=2 to Ctr1/2
If Ctr1 mod Ctr2 = 0 Then 'Checking the reminder
PrimeFlag=False
'Not a prime number
End If
Next
```

End If

If PrimeFlag=True Then

```
PrimeNumberList=PrimeNumberList&" "&Ctr1
'Collecting the prime numbers
```

End If

Next

Msgbox PrimeNumberList 'Displaying the result

flag

Write A Tutorials

Question tags

Similar questions

Follow this question

Follow qtp category

Question tags

qtp
× 1

Asked
**3 years and 5 months ago ago**

Number of Views -974

Number of Answers -2

Last updated

**3 years and 2 months ago ago**

Number of Views -974

Number of Answers -2

Last updated

Similar questions