Next i
Range("E4").Value = x
End If
Response = MsgBox("Continue?", vbYesNo)
If Response = vbNo Then
Exit Sub
End If
Loop
End Sub
VBA CODE for Problem 1.5
Sub MacPro01()
Do
Block 1
IF x = 2 THEN EXIT
Loop
End Sub
REM
*****
BASIC
*****
Sub Main
Dim x as double, y as double, i as integer, factorial as double
x=InputBox("Please Enter a number")
if x>=0 then
if x=0 then
y=1
MsgBox(1)
else
factorial = 1
For i = 1 to x
factorial = factorial * i
Next i
MsgBox(Factorial)
end if
else
Msgbox ("Error!!! Factorial of negative number doesn't exist.")
End if
End Sub