Tricentis Tosca 16.0 Released on Feb-2023 ----- UFT has been upgraded from UFT 15.0.1 to UFT One 15.0.2, Beginning at November 2020.

Saturday, 5 January 2019

Finding factorial of a given number

Dim n,f
n=inputbox("enter a number")
f=1

If n<0 Then
     msgbox "invalid number"
     else if n=0 or n=1 then
           msgbox "the factorial of given number is : "& f
 else
    For i=1 to n
           f=f*i
    Next
           msgbox "the factorial of given number is : "&f

end if
End if 


Function
---------------------------

Function Factorial(a)
x=1
For i=1 to a
  x=x*i
next
Factorial=x
End Function

Msgbox Factorial(5)




No comments:

Post a Comment

Note: only a member of this blog may post a comment.