写了一个示例,希望能帮助你
#include <stdio.h>
#include <stdlib.h>
int main(void)
{
unsigned int n;
printf("请输入一个正整数n:[1,100]");
scanf("%d",&n);
printf("输入数为%d 时,输出序列为:\n", n);
for(unsigned int i=1; i<=n; ++i){
printf("%d ", 1+3*i*(i-1)/2 );
}
printf("\n");
return 0;
}