write a vb script to calculate factorial of a number?
Answer Posted / rik mondal
The answer submitted by "mudaseer" is absolutely wrong and
the answer by "raja" is partially correct(because he did not
wrote additional HTML and script tags,which is difficult to
understand for beginners). Guys don't you check the answer
before posting?
anyways here is the correct answer. This will work 100%.
Just copy it and paste in you editor then save and compile
by IE.
<html>
<script language="vbscript">
n=inputbox("Enter a number")
dim f
f=1
if n<0 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
</script>
</html>
| Is This Answer Correct ? | 41 Yes | 16 No |
Post New Answer View All Answers
Which conditional statement is the most convenient one to use in the case of multiple conditions in the vbscript language?
Explain the arrays in vb script?
hi what is called GUI in QTP 8.2 and how can we test the apllication using GUI?
How will you convert a string to upper case string using vbscript?
Explain about the extension .hta?
Which operator is used to perform the comparison among 2 operands in the vbscript language?
What's the difference between vbscript and vb.net?
What is the purpose of drive object of scripting.filesystemobject class in vbscript?
How to write VB script for login module?
What are class variables?
Explain about adodb.stream class?
can anyone send me a vb scripts code for clicking on a link and coming back on home page again does the same for many links on a web page.
Which operator is used to concatenate the 2 values in the vbscript language?
Mention what is select case statement?
Explain about scrrun.dll?