JavaScript Program to find reverse of given number. (12)
<html>
<head>
<title></title>
</head>
<body>
<script type="text/javascript">
let n =parseInt(prompt("Enter a number"));
document.writeln("Given number is :"+n);
let p = 0;
while(n>0)
{
r = n%10;
p = p*10 + r;
n = Math.floor(n/10);
}
document.writeln("<br> Reversed number is : " + p);
</script>
</body>
</html>
Comments
Post a Comment