You should add "," to your code,so the correct question is that How to convert (scanf("%d,%d,%d",&m2,&n2,&p2);) to C#?
C# code:
using system;
int m2,n2,p2;
string input=Console.ReadLine();
string[] substr=input.Split(',');
if (substr.Length>=3)
{
m2=int.Parse(substr[0]);
n2=int.Parse(substr[1]);
p2=int.Parse(substr[2];
}