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
Hi anyone Can Send Solution to the Question wt m posting now Prepare Script for the Bellow Scenario? Login to Gmail Page Open Inbox check Mails save them in a Folder
regular expression that will recognize a browser as long as its name property starts with mybrowser
There are 5 web pages.write a script to click the button on 4th web page.
How to identify column in VSFlexgrid? My VSFlexgrid window is identified as 'Active X Control'
How to Convert Hex color code to color name in VB Script?
Mention how to assign a date value to a variable?
If else for do while select in vb script?
PLz send me the VB scripts which is having more examples my email id : hareen_11@yahoo.com
How to open a file. What is the perpose of true and false mode there?
how to write a vb script in QTP for yahoo registration form, i want to check the performance also like performance test, stress, load test like that.
I need to get some data from data base and store this
(retrieved) data in a excel sheet using VB script in QTP9.0
I have created connection for data base
I have created as excels sheet by using
Set XL=CreateObject("Excel.Application")
XLworksheet.cells(1,1).value= rs.fields.item("<
How to create a function in vbscript?
Plzzzzzzz can any one tell me which is the best institute in hyderabad for learing VBScript. plz do answer guys its urgent plzzzzzzz. thanks in advance.
What are the uses of vb script?
What is dictionary object in vbscript? Explain?