,
this answer is not perfect, its logic is correct. Validation for a floating point number has to be done. Change the code urself..
import java.io.*;
class proper
{
public static void main(String args[])
{
try
{
System.out.println("Enter the number");
InputStreamReader isr = new InputStreamReader(System.in);
BufferedReader br = new BufferedReader(isr);
String str = br.readLine();
int n = Integer.parseInt(str);
int b[]=new int[n];
if(n>0)
{
for(int i=1;i
{
if(n%i == 0)
{
b[i]=i;
}
}
System.out.print("Proper divisors of " + n + " are");
for(int i=1;i
{
System.out.print(b[i]);
}
}
else
{
System.out.println("please enter a positive number");
}
}catch(Exception e)
{
System.out.println("Caught exception " + e);
}
}
}
a perfect number is defined as a positive integer which is the sum of its proper positive divisors, that is, the sum of the positive divisors excluding the number itself 137,438,691,328 is the 7th perfect number.
120,000 has 70 proper divisors.
A perfect number equals the sum of its proper divisors. A deficient number is greater than the sum of its proper divisors. An abundant number is less than the sum of its proper divisors. Proper divisors of a number do not include the number itself.
1,2,3,4,6,8,12,24
The factors of 10 are 1, 2, 5, and 10. The proper factors, or divisors, of the integer n are the positive factors of n other than n itself. So, the proper factors of ten are 1, 2, and 5.
59
A perfect number is the term for a number that is equal to the sum of its proper divisors. Be careful not to confuse that with proper factors. Proper divisors include 1 but not the number itself. Proper factors don't include either I or the original number.
-299
no- 19 is prime which means it has no proper divisors.
1, 3, 9 and 27
an abundant number is less than the sum of its proper divisors
1, 2, 3, 4, 6, 8, 12, 24 (sum = 60)