here i want to make program get the perfect number
and there is a syntax error
i want to know
static void Main(string[] args)
{
Console.WriteLine("enter ");
int x = int.Parse(Console.ReadLine());
bool p = perfect(x);
if (p == true)
Console.WriteLine("perfect");
else
Console.WriteLine("not perfect");
}
static bool perfect(int x)
{
int sum = 0;
for (int i = 0; i <= x; i++)
{
sum += i;
if (sum == x)
return true;
else
if (sum > x)
return false;
}
}
the error