You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
function is_perfect(number)
|
|
{
|
|
var temp = 0;
|
|
for(var i=1;i<=number/2;i++)
|
|
{
|
|
if(number%i === 0)
|
|
{
|
|
temp += i;
|
|
}
|
|
}
|
|
|
|
if(temp === number && temp !== 0)
|
|
{
|
|
console.log("It is a perfect number.");
|
|
}
|
|
else
|
|
{
|
|
console.log("It is not a perfect number.");
|
|
}
|
|
}
|
|
is_perfect(28);
|