Questions tagged [perfect-numbers]

A perfect number is a positive integer that is equal to the sum of its proper positive divisors, that is, the sum of its positive divisors excluding the number itself

A perfect number is a positive integer that is equal to the sum of its proper positive divisors, that is, the sum of its positive divisors excluding the number itself.

An example of a perfect number is 6, as 1, 2 and 3 are its divisors and 1+2+3 = 6

123 questions
-5
votes
1 answer

Why don't I get any result if sum=0 declared outside of the loops?

I am a beginner. I am trying to solve a problem where I need to find the perfect numbers within a given range. The problem is ,whenever I declare sum=0 at the top, I get no result. But If I declare sum = 0 inside the loop (pictures attached) ,it…
Md Anik
  • 61
  • 5
-5
votes
6 answers

"for" loop and perfect numbers

Have to create program that list all perfect number( sum of factors = number ) 1 - 1000. this is for a java class, need to only use "for" loops I have checked my code 100 times and getting no output, I am missing a logical error somewhere, could…
user1726845
  • 109
  • 3
  • 10
-6
votes
1 answer

C Program to make a list of perfect numbers

I tried to code this but I can't run it. Please help me to check what's wrong in my code. The results I want, examples: The List of Perfect Number Give me the lastest number(start from 1): 100 6 28 This is a C program that uses…
1 2 3
8
9