For this code i am inputing one number and trying to see if it is a perfect number
#include<iostream>
#include<cmath>
#include<iomanip>
#include<conio.h>
using namespace std;
void perfect(int);
int isfactor(int, int);
int N, i;
int main()
{
perfect(N);
isfactor(N, i);
}
int isfactor(int number, int divisor)
{
if(number%divisor==0)
return 1;
else
return 0;
}
void perfect(int N)
{
int sum=0;
cout<<"Enter an integer to see whether it is a perfect number or not: "<<endl;
cin>>N;
if(N>0)
{
for(i=1; i<=N; i++);
{
if(isfactor(N, i))
{
sum+=i;
}
}
if(sum==N)
cout<<N<<" is a perfect number."<<endl;
else
cout<<N<<" is not perfect number."<<endl;
}
getch();
}
the problem is that the sum keeps coming out to be 0