The text below is selected, press Ctrl+C to copy to your clipboard. (⌘+C on Mac) No line numbers will be copied.
Guest
Tooo
By Guest on 9th February 2019 06:25:19 AM | Syntax: TEXT | Views: 2



New paste | Download | Show/Hide line no. | Copy text to clipboard
  1. <html xmlns="http://www.w3.org/1999/xhtml">
  2. <head>
  3. <title>Reverse number</title>
  4. <script type="text/javascript">
  5. function rev_num()
  6. {
  7.         var n=prompt("Enter a number:");
  8.         var num=n;
  9.         var a=0, rem=0;
  10.         while(n>0)
  11.         {
  12.                 rem=n%10;
  13.                 a=a*10 + rem;
  14.                 n=parseInt(n/10);
  15.         }
  16.         document.write("Given number: "+num);
  17.         document.write("Reverse number: "+a);
  18. }
  19. </script>
  20. </head>
  21. <body onload= "rev_num()">
  22. </body>
  23. </html>



  • Recent Pastes