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 求100以内的完数

 

上一篇:redis-JedisPoolConfig配置


下一篇:redis.clients.jedis.exceptions.JedisConnectionException: Could not get a resource from the pool