Tuesday, April 23, 2013


Perfect Number program Source Code
<html>
<head><TITLE></TITLE>
<script language="JavaScript">
var a=prompt("enter a value");
alert(a);
var z=a;
var c=0;
for(var i=1;i<a;i++)
{
//var c=0;
if(a%i==0)
{
c=c+i;
//alert("Now C IS:"+c);
}
}
if(c==z)
{
alert("given no is perfect");
}
else
{
alert("given no is not a perfect");
}
</script>
</head>
<body></body>
</html>

0 comments:

Post a Comment