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:30 AM
Bonolo Resegofetse
Bonolo Resegofetse - avatar
2 ответов
0
Can we see your try . Always put your stull before asking questions
26th Jun 2020, 8:36 AM
Ayush Kumar
Ayush Kumar - 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