public class perfect {
public static void main(String[] args) {
int n = 1;
System.out.println("*****program to find d num of perfect num's b/w 2 limits****** \n ");
for (int i = 1; i <= 50; i++) {
int sum = 0;
for (n = 1; n < i; n++) {
if (i % n == 0) {
sum = sum + n;
}
}
if(sum==i)
System.out.println(i);
}
}
}
No comments:
Post a Comment