0

Suppose that m and n are integers and m is nonzero. Recall that m is called a divisor of n if n = mt for some integer t; that is

Suppose that m and n are integers and m is nonzero. Recall that m is called a divisor of n if n = mt for some integer t; that is, when m divides n, the remainder is 0. Moreover, m is called a proper divisor of n if m < n and m divides n. A positive integer is called perfect if it is the sum of its positive proper divisors. For example, the positive proper divisors of 28 are 1, 2, 4, 7, and 14 and 1 + 2 + 4 + 7 + 14 = 28. Therefore, 28 is perfect. Write a program that does the following; a. Outputs the first four perfect integers. b. Takes. as input a positive integer and then outputs whether the integer is perfect.

26th Jun 2020, 8:31 AM
Bonolo Resegofetse
Bonolo Resegofetse - avatar
3 Respuestas
0
Your attempt??
26th Jun 2020, 8:37 AM
Arsenic
Arsenic - avatar
0
Help it kinder difficult
26th Jun 2020, 8:59 AM
Bonolo Resegofetse
Bonolo Resegofetse - avatar
0
    public static void main(String[] args) {        perfectIntiger();     }     public static int perfectIntiger(){         int sumD=mTotal;         mTotal=m1+m2+m3+m4+m5;   //sum of all the divisors     do         {        if(n/m=0&& sumD=n){                            System.out.println("n is a perfect integer");                 }                  else{                  System.out.println("n is not a perfect integer");                   }     }while(n=sumD);          }
26th Jun 2020, 9:01 AM
Bonolo Resegofetse
Bonolo Resegofetse - avatar