Return to Snippet

Revision: 43255
at March 20, 2011 07:10 by kanuwadhwa

Initial Code
<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="" layout="absolute" creationComplete="init()">
			var num:Number = 10;
			public function init():void{
				txt.text = factor(num).toString();
			public function factor(num:Number):Number{
				var mul:Number = 1;
				for(var i=2;i<=num;i++){
					mul *= i;
					txt.text += "\n >>"+mul;
				return mul;
	<mx:TextArea x="118" y="57" width="553" height="412" id="txt"/>

Initial URL

Initial Description
Looking forward for more optimized solution for the same

Initial Title
Factorial of a number

Initial Tags
actionscript, flash, Flex

Initial Language
ActionScript 3