#include <stdio.h> int main(int argc, char* argv[]) { int i,n,sum=0; start: printf("please input n:\n"); scanf("%d",&n); if(n%2==0) { printf("输入错误 请重新输入"); goto start; } for(i=1;i<=n;i+=2) { sum+=i; } printf("1+3+5+...%d=%d\n",n,sum); return 0; }