SHARE
TWEET

Untitled

a guest Feb 19th, 2020 73 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class IPN {
  2.  
  3.     public boolean isPerfectNumber(int number){
  4.          
  5.         int temp = 0;
  6.         for(int i=1; i<=number/2; i++){
  7.             if(number%i == 0){
  8.                 temp += i;
  9.             }
  10.         }
  11.         if(temp == number){
  12.             System.out.println("Ez tokeles szam, jipiajee");
  13.             return true;
  14.         } else {
  15.             System.out.println("Sajnalom, ez most nem tokeletes..");
  16.             return false;
  17.         }
  18.     }
  19.      
  20.     public static void main(String a[]){
  21.         System.out.println("Ez tokeletes szam: "+ipn.isPerfectNumber(28));
  22.     }
  23. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top