you can define the default value of that parameter to be null, so that then you can check if that parameter is == null, so with your example it would be
class Program
{
static void Main(string[] args)
{
var c= cc(5);
}
public static int cc(int a, int? b = null)
{
int c=0;
if(b is not null)
{
c = a * b;
}
else
{
c =a*a;
return c;
}
}