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                      
Google
   
 
Categories >> Code Snippets >> Programming Code >> Dot Net Code >> C Sharp Code
 
 


 

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

 
 
 
Other C Sharp Code Interview Questions
 
  Question Asked @ Answers
 
how does the below eqation proceed to be solved: x*=y+z options: x=x*y+z or x=x*(y+z)   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. TCS 1
Event Handling in C# Triggering a Button   1
Write a program to count the number of characters, number of words, number of line in file. Mind-Tree 2
Write a program which has a function and that function should take 2 or 3 or any number of strings and it should return the largest common prefix of all those strings. If there is no common prefix it should return an empty string. for eg:- INPUT OUTPUT glo {glory,glorious,glod} gl {glad,glow} {calendar,phone} empty string Mind-Tree 2
Coding for using Nullable Types in C#?   1
program for addition of fraction(M/N + P/Q = Y/Z) Mind-Tree 1
How to use ASP.NET 2.0's TreeView to Display Hierarchical Data?   1
program for string reverse(eg:- i am boy -> boy am i) Mind-Tree 8
Coding for Manipulate XML File Data Using C#?   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-Tree 2
 
For more C Sharp Code Interview Questions Click Here 
 
 
 
 
 


   
Copyright Policy  |  Terms of Service  |  Articles  |  Site Map  |  RSS Site Map  |  Contact Us
   
Copyright 2013  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  KalAajKal.com