answersLogoWhite

0


Best Answer

,

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);

}

}

}

User Avatar

Wiki User

8y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Java program that computes proper divisors af an integer?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is the seventh perfect number?

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.


How many proper divisors does 120000 have?

120,000 has 70 proper divisors.


What is a perfect Abundant Or dificient number?

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.


What are the proper divisors for 24?

1,2,3,4,6,8,12,24


Proper factors of ten?

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.


How many proper divisors are in 7920?

59


What is the term for equal to the sum of its proper factors?

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.


What are all the perfect numbers 1 - 300?

-299


Is 19 composite?

no- 19 is prime which means it has no proper divisors.


What are the proper divisors of 81?

1, 3, 9 and 27


What does abundant mean in proper factors?

an abundant number is less than the sum of its proper divisors


What are the proper divisors of 24 and the sum of these divisors?

1, 2, 3, 4, 6, 8, 12, 24 (sum = 60)