Home    Page 2    Page 3    Page 4    Page 5    Physics    Math    Fluid Mechanics    Investment Finance     Mortgage Calculator     Nursing

AJ PHP Software Source Code Math Library
Factorial Integer

integer factorial_integer ( integer n)

Description:

factorial_integer returns the the factorial given an integer.

Source Code:

 function factorial_integer (\$k) {   //variable and initializations   \$the_result = 1;   //check to see if k is an integer   if (!is_int(\$k))   {     return "error";   }   //check for k < 0   if (\$k < 0)   {     return "error";   }   //0! = 1   if (\$k == 0)   {     return 1;   }   //calculate the result   for (\$i = 2; \$i <= \$k; \$i++)   {     \$the_result = \$the_result * \$i;   }   //return the value   return \$the_result; }

Example:

 "; echo "the_factorial = \$the_factorial
"; ?>

Run Example

 array average solve for the average of an array factorial integer solve for the factorial of an integer log base solve for the base of the logarithm function

References - Books:
Max A. Sobel, Nobert Lerner. 1991. Precalculus Mathematics. Prentice Hall.
 Subwoofer Box Software Downloads for Sealed, Ported and Bandpass Salary Wage Pay Calculator - Jobs Career Baby Infant Growth Charts - Weight Age Percentile Dog Age Calculator - Human Age Converter Fraction Calculator - Simplify Reduce Engine Horsepower Calculator Earned Value Project Management Present Worth Economics Calculator Constant Acceleration Motion Calculator Statistics Equations Formula Calculator Mortgage Payment Finance Calculator Weight Loss Formulas Calculator Body Mass Index BMI Calculator Fluorescent Light Bulb Cost Analysis Calculator Automobile Fuel Economy CalculatorGasoline Diesel Car Truck Tire Size Comparison Calculator Paycheck and Overtime Rate Calculator Sale Discount Calculator - Percent Off Price
 by Jimmy Raymond Technical Tools, Specifications, How to Guides, Reviews, Training, Applications, Examples, Tutorials, Answers, Test Review Resources, Analysis, Homework Solutions, Help, Data and Information for Engineers, Technicians, Teachers, Tutors, Researchers, K-12 Education, College and High School Students, Science Fair Projects and Scientists Contact: aj@ajdesigner.com Privacy Policy, Disclaimer and Terms Copyright 2002-2011