In: Computer Science
using System;
using System.Data.SqlTypes;
using System.Globalization;
using System.Reflection.Metadata.Ecma335;
using System.Runtime.Intrinsics.X86;
using System.Security.Cryptography.X509Certificates;
namespace ConsoleApp4
{
class Program
{
static void Main(string[] args)
{
AO function = new AO(1000, 3);
function.Find();
}
}
class AO
{
public a(long _max , long _least)
{
max = _max;
least = _least;
numm = new long[1000];
}
public long max;
public long least;
public long[] numm;
public long Find()
{
long per =0;
long sum = 0;
for(int i=1; i<=max; i++)
{
  
for(int j=0;j<i;j++)
{
if(j%i==0)
{   
sum = sum + j;
per++;
}
if (sum != i)
continue;
else
numm[per] = i;
}
}
return per;
}
  
}
  
}
Please let me know why it doesn't work.
Below is the correct program.
Constructor should have the same name ast that of class.
Replaced below statment
public a(long _max , long _least)
with
public AO(long _max, long _least).
Also no need to include unnecessary packages in your program.
using System.Data.SqlTypes;
using System.Globalization;
using System.Reflection.Metadata.Ecma335;
using System.Runtime.Intrinsics.X86;
using System.Security.Cryptography.X509Certificates;
Below is the correct program, which is compiling fine and working
namespace ConsoleApp4
{
    class Program
    {
        static void Main(string[] args)
        {
            AO function = new AO(1000, 3);
            function.Find();
        }
    }
    class AO
    {
        public AO(long _max, long _least)
        {
            max = _max;
            least = _least;
            numm = new long[1000];
        }
        public long max;
        public long least;
        public long[] numm;
        public long Find()
        {
            long per = 0;
            long sum = 0;
            for (int i = 1; i <= max; i++)
            {
                for (int j = 0; j < i; j++)
                {
                    if (j % i == 0)
                    {
                        sum = sum + j;
                        per++;
                    }
                    if (sum != i)
                        continue;
                    else
                        numm[per] = i;
                }
            }
            return per;
        }
    }
}