This is what I have for a factorial equation but everytime I input a number over 34 it gives me infinity....
Is there a way where I can input numbers greater than 34 and it still shows me the results of it?
Thanks
Dim ninput As Long, routput As Long
Dim result As Long, a As Long
If Not IsNumeric(n_val.Text) Then
MsgBox(
"Please Input a Number")
Exit Sub
End If
If n_val.Text < 0 Then
MsgBox(
"Please Input a Positive Number")
Exit Sub
End If
ninput = Val(n_val.Text)
If Not Val(n_val.Text) = Int(ninput) Then
MsgBox(
"Please Input a Whole Number")
Exit Sub
End If
If ninput <= 1 Then
routput = 1
End If
result = 1
For a = 2 To ninput Step 1
result = result * a
Next a
r_val.Text = Str(result)
Is there a way where I can input numbers greater than 34 and it still shows me the results of it?
Thanks
Dim ninput As Long, routput As Long
Dim result As Long, a As Long
If Not IsNumeric(n_val.Text) Then
MsgBox(
"Please Input a Number")
Exit Sub
End If
If n_val.Text < 0 Then
MsgBox(
"Please Input a Positive Number")
Exit Sub
End If
ninput = Val(n_val.Text)
If Not Val(n_val.Text) = Int(ninput) Then
MsgBox(
"Please Input a Whole Number")
Exit Sub
End If
If ninput <= 1 Then
routput = 1
End If
result = 1
For a = 2 To ninput Step 1
result = result * a
Next a
r_val.Text = Str(result)