HOME

Wednesday, November 9, 2016

WML program to check whether the given number is palindrome or not.

#WML FILE
<?xml version="1.0"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.2//EN"
"http://www.wapforum.org/DTD/wml12.dtd">
<wml>
<card id="card1">
<p>
<do type="accept" label="Check Number">
<go href="prime.wmls#check()"/>
</do>
</p>
</card>
</wml>

#WMLS SCRIPT FILE
    extern function check()
    {
    var num=Dialogs.prompt("Enter Number",0);
    var n=Lang.parseInt(num);
    var rev=0;
    var number=n;
    while(n>0)
    {
    var rem=n%10;
    rev=rem+rev*10;
    n=n div 10;
    }
    if(rev==number)
    {
    Dialogs.alert("It is palindrome Number");
    }
    else
    {
    Dialogs.alert("It is not palindrome Number");
    }
    }
   

No comments:

Post a Comment