mangboi
Plz give the answers
1 Answer(s)      6 years and 7 months ago
Posted in : Java Interview Questions
Advertisement
View Answers

January 19, 2009 at 1:34 AM


Hi friend,

Code to help in solving the problem :

public class PerfectNumber {
public static void main(String args[])
{
int a=5,b=0,c=0,d=0;
System.out.println("Enter a Number");

d=a;
for (int i=1;i<=a-1;i++)
{
b=a%i; // im not sure if its b= n%i or b=i%n i cant remember which is the right one
if(b==0)
{
c=c+i;
}
}
if(d==a)
System.out.println("Entered Number is perfect number");
else
System.out.println("Entered Number is not perfect");
}
}

For read more information,Examples and tutorials on java visit to :

http://www.roseindia.net/java/


Thanks









Related Tutorials/Questions & Answers:
Plz give the answers - Java Interview Questions
Plz give the answers  1.Computing cos(x) using the cosine series: Recall that cos(x) is given by the following series: Write a program to compute cosine of a number x using the above series. Ignore terms less than 0.00001.
plz give me answer plz
plz give me answer plz  writw a programme to find rank from an array using doubledimmensionalarray
Advertisements
plz give me answer
plz give me answer  Discuss & Give brief description about string class methods   Java string methods
plz give me answer
plz give me answer   description about string class methods   Java string methods
plz give me answer
plz give me answer   description about string class methods   Java string methods
plz give me answer
plz give me answer   description about string class methods   Java string methods
Plz give java coding for this
Plz give java coding for this  ... iMin = 1, iMax = 8, iMid; // give max. value in even no. int jMin = 1, jMax = 12, jMid; // give max. value in even no. iMid = iMax / 2; jMid = jMax / 2
Plz give me code for this question
Plz give me code for this question  Program to find depth of the file in a directory and list all files those are having more number of parent directories
plz Help me find the correct programs answers
INDICA" and "TATA NANO" respectively. Plz mail me your answers...plz Help me find the correct programs answers   Create a washing machine class with methods as switchOn, acceptClothes, acceptDetergent, switchOff
StringIndexOutOfBound error !!! plz give me the reason for this error ,plz.........
StringIndexOutOfBound error !!! plz give me the reason for this error ,plz.........  import java.util.Scanner; class Even { static int getEven(int firstno,int secondno) { int counteven=0; for(int i=firstno;i<=secondno;i
how can i add wirecard option(or button ) at my web page plz tell all steps? View Answers
how can i add wirecard option(or button ) at my web page plz tell all steps? View Answers  how can i add wirecard option(or button ) at my web page plz tell all steps? View Answers
plz give me program to this: Given a string and a number ‘n’, find the ‘n’th distinct repeating character.
plz give me program to this: Given a string and a number ?n?, find the ?n?th distinct repeating character.    Given a string and a number ?n?, find the ?n?th distinct repeating character. For example, Input: Abracadabra, 1
Questions and Answers Help
programmers to give precise answers to your question. Describe your question...Questions and Answers Help      ...://www.roseindia.net/answers/viewqa/Java-Beginners/11976-Java-Hello-World-code
Questions and Answers Help
programmers to give precise answers to your question. Describe your question...Questions and Answers Help      ...://www.roseindia.net/answers/viewqa/Java-Beginners/11976-Java-Hello-World-code
Software Questions and Answers
by providing the answers to their questions online. Its very easy give the answer...Software Questions and Answers       View Software Questions and Answers online Discuss Software
Outsourcing - Answers to Critism, Outsourcing Answers Critics
Outsourcing - Answers to Criticism, Outsourcing Answers Critics Introduction As the outsourcing juggernaut rolls on, business analysts have come up with arguments favoring and criticizing it. Cost savings
I want this jsp answers
I want this jsp answers    How can we declare third party classes and interfaces inside our jsp page? How can we declare and definr global variables and methods inside our jsp page? If we are declaring global variables
I want this jsp answers
I want this jsp answers    How can we declare third party classes and interfaces inside our jsp page? How can we declare and definr global variables and methods inside our jsp page? If we are declaring global variables
Plz Help
Plz Help  Hello Guys!! Plz. Help I need to write a program to display the astrological sign based on your birthday for example If we enter the date of birth in the following format from console--13/08/1990 it should give you
Software Questions and Answers
Software Questions and Answers View Software Questions and Answers online Discuss Software development questions, ask your questions and get answers... browse through these questions to find the answers to your software development
plz plz plz inform me as soon as possible
plz plz plz inform me as soon as possible  ``by using c programs how to type
give answer
give answer  . Which of the following will he use to compile the KeyTest class successfully
give idea
give idea  how to plot graph in java   Please visit the following link: http://www.roseindia.net/java/example/java/swing/draw-simple-bar-chart.shtml
Core Java Interview questions and answers
Core Java Interview questions and answers  ... and answers in one place. These Core Java Interview Questions are supported with the answers, so that you don't have again search the internet to find
plz help
plz help  what is the procedure and code to design an interactive GUI in java using swings
plz plz rply as soon as possible
plz plz rply as soon as possible  by using c programs * * * * * s s s s s * s s o s s s s s s s s s s s s s s s s s s s s s s s
give the code for servlets session
give the code for servlets session  k give the code of total sample examples of servlet session