相关知识点: 试题来源: 解析 解:#include <> void main() { int a,d,n,sum; printf(“请输入等差数列的首项 公差 项数\n”); scanf(“%d%d%d”,&a,&d,&n); sum=a*n+n*(n-1)*d/2; printf(“ sum=%d\n”,sum); }反馈 收藏 ...
include<stdio.h> int main(){ int a,n,d,sum=0;printf("请输入首项a:");scanf("%d",&a);fflush(stdin);printf("\n请输入项数n:");scanf("%d",&n);printf("\n请输入公差d:");scanf("%d",&d);sum=n*a+d*n*(n-1)/2;printf("\n前n项的和为:%d\n",sum);return ...
int main(){ int a,n,d,sum=0; printf("请输入首项a:"); scanf("%d",&a); fflush(stdin); printf("\n请输入项数n:"); scanf("%d",&n); printf("\n请输入公差d:"); scanf("%d",&d); sum=n*a+d*n*(n-1)/2; printf("\n前n项的和为:%d\n",sum); return 0; } 希望我的...