Thursday, January 12, 2012

Find the factorial of a number using vb script

for Technical interviews:

http://no1tutorial.com/

learn step by step technologies:


http://no1tutorial.com/

n=cint(inputbox(“Enter a number”))
dim f
f=1
if n<0 data-blogger-escaped-br="" data-blogger-escaped-then=""> msgbox “Invalid number”
elseif n=0 or n=1 then
msgbox “The factorial of given number “&n&” is :”&f
else
for i=n to 2 step -1
f=f*i
next
msgbox “The factorial of given number “&n&” is :”&f
end if

No comments:

Post a Comment