使最后一次输出后面没有空格 很简单,空格加在前面 int first =1; //竟然没想到 ,可能是习惯使然 if(first) first = 0; else printf(" "); printf("%d",/*要输出的内容*/)