Java to find perfect numbers within 1000

From , 5 Years ago, written in Java, viewed 189 times.
URL https://pastebin.vip/view/d278df49
  1. public class PerfectNumber {
  2. public static void main(String[] args){
  3. for(int i=2;i<1000;i++){
  4. int sum=0;
  5. //查找因数
  6. for(int j=1;j<i;j++){
  7. if(i % j==0)
  8. sum += j;
  9. }
  10. if(sum==i)
  11. System.out.println(i);
  12. }
  13. }
  14. }

Reply to "Java to find perfect numbers within 1000"

Here you can reply to the paste above

captcha

https://burned.cc - Burn After Reading Website