Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

What is wrong with this program in Visual studio C#, Console application Please

ID: 3680318 • Letter: W

Question

What is wrong with this program in Visual studio C#, Console application Please Help me:

Console.Write("Enter A Number:");
int thenumber;
thenumber: Convert.ToInt32(Console.ReadLine());
bool is prime
for (int i = 2; i <= thenumber; i++)
{
if (thenumber % i == 0)
{
is prime = false;
}
}
if (is prime= True)
Console.WriteLine("your number is prime");
{
}

else
{
for(int j=1; j< thenumber; j++)
Console.WriteLine("The factors of your number are");
{
if(thenumber % j == 0)
{
Console.WriteLine(j);
}
}
}
Console.ReadLine();
}
}
}   

Explanation / Answer

class Program
{

static void Main(string[] args)
{
Console.Write("Enter a Number : ");
int thenumber,j;
thenumber = Convert.ToInt32(Console.ReadLine());
int k;
k = 0;
for (int i = 1; i <= thenumber; i++)
{
if (thenumber % i == 0)
{
k++;
}
}
if (k == 2)
{
Console.WriteLine("your number is prime");
}
else
{
Console.WriteLine("Not a Prime Number");
}
Console.WriteLine("The factors of your number are");
for (j = 1; j <= thenumber; j++)
{
if (thenumber % j == 0)
{
Console.WriteLine(j);
}
}
  
Console.ReadLine();
}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote