Sunday, March 25, 2018

Armstrong Program In HTML.

This Program Is About How To Check Number Is Armstrong Or Not In HTML.



<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
<script language="javascript">
var no;
var temp;
var sum=0;
var original;
no=parseInt(prompt("enter number:"));
original=no;
while(no>0)
{
temp=no%10;
sum+=(temp*temp*temp);
no=parseInt(no/10);
}
if(sum==original)
{
document.write("This is an Armstrong No=",original);
}
else
{
document.write("This is Not an Armstrong No=",original);
}
</script>

</body>
</html>

No comments:

Post a Comment

Generate Even Numbers in a Range In PHP.

$start = 1; $end = 20; for ($i = $start; $i <= $end; $i++) {     if ($i % 2 == 0) {         echo $i . " is even.<br>";   ...