To check the prime number,use these code
class AB
{
public static void main()
{
console.write("Enter an number: ");
int num;
num=convert.ToInt32(console.ReadLine());
int k;
k=0;
for(int i=1;i<=num;i++)
{
if(num%i==0)
{
k++;
}
}
if(k==2)
{
console.WriteLine("Enetred a Prime number and the largest factor: ")
}
else
{
console.WriteLine("Not a Prime Number");
}
console.ReadLine();
}
}
}