Your method takes one argument testNum
. If you don’t pass it while calling this method. The compile time error occurs saying:
No overload for method 'IsPrime' takes 0 arguments
Wrong call:
IsPrime(); //no argument is being passed
Right way to invoke this:
IsPrime(3); //any integer can be passed