Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

How will you get the smallest subscript of an array in vbscript?

1334


We have 1 web page with names column. I am giving the Service Providers1,2,3.... @ that time dynamically some no of names are displaying in the webpage and The Pop up windows are opening(No.of Pop Up windows=No.of Names). The names may be diffar for each and every Service Provders (Dynamically) How can we handle the Dynamic values?

2161


What are subprocedures in vbscript?

1077


How will you release the memory acquired by an array variable in vbscript?

1187


How can constants be declared in the vbscript language?

959


Mention what is select case statement?

921


Please let me Know regarding any material regarding VB Scripting which should be easily understandable for Beginners.

1997


How to capture a runtime error in vbscript?

1107


Explain the operator precedence in vb script?

1035


how to increasing the numbers in a given text box please write a vb script

2180


What is the purpose of on error resume next statement?

943


Which constant is used for print and display functions and works as same as pressing enter key?

968


Out of the different type of operators, which are evaluated first and last in the vbscript language?

963


What methods are used to create text files and open text files in the vbscript language?

949


1.I want to establish connection with excel and also want to fetch the data using SQL queries. 2.the code should be written in such a way that in future if I want to migrate from excel to MS excess database , then there should be minimal changes.

1970