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 Create Files by Using the FileInfo Class?
program for straight line(y=mx+c)
Hello Sir, Thanks for the Solution but, can you pls. Explain the coding for the Static Function & static variable from the below coding....waiting for Ans. class fact { public static void Main() { fact f=new fact(); int x=1; //Declaration of x as 1 int k=Convert.ToInt32(Console.ReadLine()); for(int i=1;i<=k;i++) { x= x *i; } System.Console.WriteLine(x); } }
How to find No of classes,Packages,No of Methods per Classes and Depth of Inheritance for selecting source code in windows form application using c# .net? (Source code is input Program. It may be Java or .net) Please help me..) Thanks..)
program for string reverse(eg:- i am boy -> boy am i)
8 Answers Black Pepper, Infosys, Mind Tree,
working with arrays
. Write a program to print the following outputs using for loops $ $ $ $ $ $ $ $ $ $ $ $ $ $ $
How to add a value from textBox over an existing certain column in SQL Server
Code for Reading and writing from a file?
how does the below eqation proceed to be solved: x*=y+z options: x=x*y+z or x=x*(y+z)
how can i split sting in textbox in windows application using c# .net
how to change password in .net with c # with ado.net and also SQL server 2008 change password