answersLogoWhite

0

,

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

10y ago

What else can I help you with?

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.


Is 36 perfect?

No, 36 is not a perfect number. A perfect number is defined as a positive integer that is equal to the sum of its proper divisors (excluding itself). For 36, the proper divisors are 1, 2, 3, 4, 6, 9, and 12, which sum to 37, not 36. The smallest perfect number is 6.


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.


Why is 74 not a perfect number?

A perfect number is defined as a positive integer that is equal to the sum of its proper divisors, excluding itself. For 74, the proper divisors are 1, 2, 37, and their sum is 1 + 2 + 37 = 40, which is not equal to 74. Therefore, 74 does not meet the criteria to be classified as a perfect number.


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.


What are the proper divisors for 24?

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


Is 30 abundant deficient or a perfect number?

The number 30 is a perfect number. A perfect number is defined as a positive integer that is equal to the sum of its proper divisors, excluding itself. The proper divisors of 30 are 1, 2, 3, 5, 6, and 15, which sum to 30. However, it should be noted that 30 is actually classified as an abundant number because the sum of its proper divisors (1 + 2 + 3 + 5 + 6 + 15 = 32) is greater than 30.


How is 8589869056 a perfect number?

8589869056 is not a perfect number. A perfect number is a positive integer that is equal to the sum of its proper divisors, excluding itself. In the case of 8589869056, the sum of its proper divisors is less than the number itself, making it an abundant number, not a perfect number.


How many proper divisors are in 7920?

59


What are the perfect numbers between 1 and 28?

The perfect numbers between 1 and 28 are 6 and 28. A perfect number is defined as a positive integer that is equal to the sum of its proper divisors, excluding itself. For example, the divisors of 6 are 1, 2, and 3, which sum to 6, while the divisors of 28 are 1, 2, 4, 7, and 14, which also sum to 28.


What are all the perfect numbers 1 - 300?

-299