try
static void Main()
{
string a = GetAutoNumber("1");
string a1 = GetAutoNumber("11");
string a2 = GetAutoNumber("111");
string a3 = GetAutoNumber("1111");
}
public static string GetAutoNumber(string lastPRNo)
{
string prefix = "PR";
string number = lastPRNo;
if (lastPRNo.Length < 3)
{
number = "000" + lastPRNo;
number = number.Substring(number.Length - 3, 3);
}
return prefix + number;
}