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 |
"c sharp" code for factorial using static variables
how to change password in .net with c # with ado.net and also SQL server 2008 change password
how does the below eqation proceed to be solved: x*=y+z options: x=x*y+z or x=x*(y+z)
Write a function which accepts list of nouns as input parameter and return the same list in the plural form. Conditions: i) if last letter is r then append s ii) if word ends with y then replace it by ies iii) call this function in main() and produce the required output. for eg:- if chair is input it should give chairs as output.
How to Link Different Data Sources Together?
How to use ASP.NET 2.0's TreeView to Display Hierarchical Data?
program to reverse the order of digits in a given number of any length.
Code for Working with Files under a Directory?
how do i copy textbox contents of 1 form to another form
how to get the table names via c sharp and column names also?
Give the code for Handling Mouse Events?
Automatically Hyperlink URLs and E-Mail Addresses in ASP.NET Pages with C#