ALLInterview.com :: Home Page            
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip       Ask Questions on ANYTHING, that arise in your Daily Life at     FORUM9.COM
Google
   
 
Categories  >>  Code Snippets  >>  Programming Code  >>  Dot Net Code  >>  C Sharp Code
 
 


 

 
 ASP.NET Code interview questions  ASP.NET Code Interview Questions
 VB.NET Code interview questions  VB.NET Code Interview Questions
 C Sharp Code interview questions  C Sharp Code Interview Questions
 ADO.NET Code interview questions  ADO.NET Code Interview Questions
Question
program to check if a number is "perfect number".
 Question Submitted By :: Lakshmipriya
I also faced this Question!!     Rank Answer Posted By  
 
  Re: program to check if a number is "perfect number".
Answer
# 1
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 ?    9 Yes 10 No
Athresh
 

 
 
 
Other C Sharp Code Interview Questions
 
  Question Asked @ Answers
 
program for string reverse(eg:- i am boy -> boy am i) Mind-Tree8
How to Create a Treeview Menu in ASP.NET with C#?  1
Write a program to input an integer and - display the reverse - display the sum of each digit - should include logic that considers the input number as any number of digits long Mind-Tree2
how to change password in .net with c # with ado.net and also SQL server 2008 change password  1
Automatically Hyperlink URLs and E-Mail Addresses in ASP.NET Pages with C#  1
program to reverse the order of words in a string. Mind-Tree2
"c sharp" code for factorial using static variables  8
Coding for using Nullable Types in C#?  1
How to Create Files by Using the FileInfo Class?  1
How to pass multiple rows from one gridview to another gridview after clicking the checkbox. Satyam1
How to use ASP.NET 2.0's TreeView to Display Hierarchical Data?  1
c# coding for a program that takes a 3 digit number n and finds out whether the number 2^n + 1 is prime, or if it is not prime find out its factors not using the Big-integer and Exponential Function's. TCS1
 
For more C Sharp Code Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2012  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com