#include<stdio.h> void main() { int a,n,d,s; printf("请按顺序输入等差数列的首项、项数、公差:\n"); scanf("%d%d%d\n",&a,&n,&d); s=n*n*d/2-n*d/2+a*n; printf("sum=%d\n",s); }