有什么问题欢迎来我的博客留言,看到就会回复,希望大家关注我,有学习的经验就会分享出来
https://blog.csdn.net/m0_63111921/article/details/122530663?spm=1001.2014.3001.5501
#include<stdio.h> int main() { int num=0; while(scanf("%d",&num)!=EOF) { int sum=num*num*num; int *arr=(int*)malloc(num*sizeof(int)); arr[0]=num*num-num+1; for(int i=1;i<num;i++) { arr[i]=arr[i-1]+2; } printf("%d",arr[0]); for(int j=1;j<num;j++) { printf("+%d",arr[j]); } printf("\n"); } return 0; }