Hi, I was having a bit of trouble with a program that I was supposed to write for a homework assignment. The program's purpose is to find all of the perfect numbers between 1 and 100 (For those who dont know, a perfect number is a number is equal to the sum of all its divisors not including itself). The program runs, but it returns that there are no perfect integers. Here is the code I'm using:
Thanks for any help.
*The program computes and displays all of the perfect numbers from 1 to 100.
bool check_perfect(int num);
printf("The perfect numbers in the range 1-100:\n");
if (flag==true) (printf("%d\n",num));
bool check_perfect(int num)
if (check==true) sum=sum+num1;
if (num==sum) return (true);
else return (false);