polindrom


<html>
<head>
<title>number polindrome</title>
<script type="text/javascript" >
var num,n,rev=0,sum=0;
n=window.prompt("enter a number to check whether it is polindrome or not","0");
num=parseInt(n);
var digit;
var temp=num;
while(num>0)
{
digit=num%10;
     sum=sum+digit;
rev=(rev*10)+digit;
num=Math.floor(num/10);

}
document.writeln("<h2>enterd number is:"+temp+"</h2><br/>");
document.writeln("<h2>sum of digits"+temp+"is:"+sum+"</h2><br/>");
document.writeln("<h2>reverse of given number is:"+rev+"</h2><br/>");
if(rev==temp)
window.alert(temp+"is a polindrome");
else
window.alert(temp+"is not a polindrome");
</script>
</head>
<body>
<p>click refresh to run script again</p>
</body>
</html>

No comments:

My Favorite Books

  • C and Data Structures by Ashok N. kamthane
  • Web Technologies by A. A. Puntambekar
  • Learn HTML and CSS with W3Schools
  • Learn JavaScript and Ajax with W3Schools
  • HTML5 Black Book: Covers Css3, Javascript,XML, XHTML, Ajax, PHP And Jquery
  • HTML5 Application Development Fundamentals: MTA Exam 98-375
  • .NET 4.0 Programming 6-In-1, Black Book
  • SQL Server 2008 R2 Black Book
  • Asp.net 4.0 Projects Covers: net 3.5 And .net 4.0 Codes, Black Book
  • UNIX Shell Programming 1 Edition by Yashavant Kanetkar
  • UNIX and Shell Programming 1 Edition by Richard F. Gilberg, Behrouz A. Forouzan
  • Computer Networks by Andrew S. Tanenbaum
  • Multiple Choice questions in computer science by Timothy J Williams