Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


program to check if a number is "perfect number".



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

Post New Answer

More C Sharp Code Interview Questions

"c sharp" code for factorial using static variables

9 Answers  


how to change password in .net with c # with ado.net and also SQL server 2008 change password

1 Answers  


how does the below eqation proceed to be solved: x*=y+z options: x=x*y+z or x=x*(y+z)

1 Answers  


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.

0 Answers   Mind Tree,


How to Link Different Data Sources Together?

0 Answers  


How to use ASP.NET 2.0's TreeView to Display Hierarchical Data?

1 Answers  


program to reverse the order of digits in a given number of any length.

1 Answers   Mind Tree,


Code for Working with Files under a Directory?

1 Answers  


how do i copy textbox contents of 1 form to another form

4 Answers   Wipro,


how to get the table names via c sharp and column names also?

2 Answers   Sify,


Give the code for Handling Mouse Events?

0 Answers  


Automatically Hyperlink URLs and E-Mail Addresses in ASP.NET Pages with C#

1 Answers  


Categories
  • ASP.NET Code Interview Questions ASP.NET Code (46)
  • VB.NET Code Interview Questions VB.NET Code (9)
  • C Sharp Code Interview Questions C Sharp Code (51)
  • ADO.NET Code Interview Questions ADO.NET Code (8)