program to check if a number is "perfect number".
Answer / athresh
public boolean isPerfect(int number)
{
int i = sumFactors(number);
if (i == number)
{
return true;
}
else
return false;
}
public int sumFactors(int number)
{
int factor = 0, sum = 0;
for (int i = 1; i < number; i++){
if (!(number % i)){
factor = i;
sum += factor;
}
}
return sum;
}
| Is This Answer Correct ? | 13 Yes | 13 No |
how to change password in .net with c # with ado.net and also SQL server 2008 change password
How to pass multiple rows from one gridview to another gridview after clicking the checkbox.
Code for Reading and writing from a file?
Code for Working with Files under a Directory?
Code for Reading and writing from a file in c#?
program to reverse the order of words in a string.
program to check if a number is "perfect number".
program for straight line(y=mx+c)
program for addition of fraction(M/N + P/Q = Y/Z)
Write a program. there are 1..n numbers placed in an array in random fashion with one integer missing. find the missing number.
Code for Searching for Multiple Matches with the MatchCollection Class?
How to add a value from textBox over an existing certain column in SQL Server