Kayshav.com
About Developer Oracle 11g Technology Information Sitemap


Enter a number:



The Factorial Value Is:  



Javascript functions to compute factorial
function showFactorial(form) {
  var input = form.anyNumber.value;
   if (isNumeric(input)) {
     if (input <= 170) {
       document.formfact.txtFactorial.value = factorial(input);
       alert ("The Factorial Value Of " + input + " Is "+ factorial(input));
     }
     else {
       alert ("Input too large!! " + input + " should be less than 171");
     }
   }
   else {
     alert ("Error!! " + input + " Is Not a Positive Number");
   }
}

function isNumeric(s) {
  var validNumbers = "0123456789";
  for (var i=0; i< s.length; i++) {
    if ( !(validNumbers.indexOf(s.charAt(i))>= 0) ) {
      return false;
    }
  }
  return true;
}

function factorial(n) {
  if ((n == 0) || (n == 1)) return 1
  else {
    factValue = (n * factorial(n-1))
  return factValue
  }
}

   Monthly Loan Payment Calculation

   Nearest Number

   App-Dev

   Piosson Distribution

   Math Reference


Last Revised On: April 10th, 2014


  4503