Remove the .Tostring() from ids.
Please see the below code
protected void btnAns_Click(object o, EventArgs a)
{
foreach (Control c in lblQues.Controls)
if (c is HtmlAnchor)
{
ids = ids + " " + c.ID;
Type type = c.GetType();
string id = type.Name;
}
lblAns.Text = ids;
}