Page 373 - computer science (868) class 11
P. 373

17          }
                  18          void check()

                  19          {
                  20              if(num == sum_of_factors(1))  // calling recursive method

                  21                  // display
                  22                  System.out.println(num + " is a Perfect Number");

                  23              else
                  24                  System.out.println(num + " is not a Perfect Number");
                  25          }

                  26          public static void main(int x)

                  27          {
                  28              // Object creation and method calling
                  29              Perfect obj = new Perfect(x);

                  30              obj.check();
                  31          }

                  32      }


                 When you execute the preceding program, the Method Call dialog box appears:
















                 The output of the preceding program is as follows:

                 6 is a Perfect Number
























                                                                                                                       371
                                                                                                           Recursion   371
   368   369   370   371   372   373   374   375   376   377   378