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 add a value from textBox over an existing certain column in SQL Server
how to get the table names via c sharp and column names also?
Code for IP Address Comparison and Conversion in C#?
Write a program to convert postfix expression to infix expression.
Write a program to count the number of characters, number of words, number of line in file.
Can you declare an array of mixed Types?
How to Create a Treeview Menu in ASP.NET with C#?
Code for Searching for Multiple Matches with the MatchCollection Class?
Give the code for Handling Mouse Events?
"c sharp" code for factorial using static variables
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.
program to reverse the order of digits in a given number of any length.