这个还挺容易的. #include <stdio.h> int main() { int n; scanf("%d",&n); for(i=2;i<=n;i++) { if(i==2) printf("2"); if(i%2!=0) printf("%d",i); } }