java 求100以内的完数
作者:互联网
1 public class demo4 { 2 3 public static void main(String[] args) { 4 // TODO Auto-gen·erated method stub 5 int i=1; 6 int j; 7 int s1; 8 while(i<=100){ 9 j=1; 10 s1=0; 11 while(j<i){ 12 if(i%j==0){ 13 s1=s1+j; 14 } 15 16 j++; 17 18 } 19 if(s1==i){ 20 System.out.println(i+"是完全数"); 21 } 22 23 i++; 24 } 25 } 26 27 }
标签:java,完数,int,Auto,void,demo4,100,public 来源: https://www.cnblogs.com/itszx/p/15611926.html