Creating a Function, Calling a Function - Code

Latest

programs

Friday, October 7, 2011

Creating a Function, Calling a Function


Creating a Function, Calling a Function


----------------------------------------------- 


function poly(x:Number):Number


{


            var res=0,x1;


            while(x>0)


            {


                        x1=x%10;


                        x=Math.floor(x/10);


                        res=res*10+x1;


            }


            return res;


}


var n:Number=323;


var n1=poly(n);


if(n==n1)


trace("Given number is palindrome");


else


trace("Given number is  not palindrome");






---------------------------------------------
Output 




Given number is palindrome

No comments:

Post a Comment