QUOTE(seec77 @ Jul 11 2006, 11:19 AM)

I think you forgot to post the code!

This program is inmediate. The sum of an arithmetic serie, when you know the first and last term of a serie of n elements:
S=N*(a[1]+a[N])/2;
but you know that
a[N]=a[1]+(N-1)*d;
Doing arithmetics, then:
a[1]=S/N-(N-1)*d/2;
a[n]=S/N+(N-1)*d/2;
CODE
#include <stdio.h>
int main()
{
double d,s,a1,an;
long n;
printf("\nHow many terms? ");
scanf("%d",&n);
printf("\nSum of all terms? ");
scanf("%lf",&s);
printf("\nCommon difference? ");
scanf("%lf",&d);
a1=s/n-(n-1)*d/2;
an=s/n+(n-1)*d/2;
printf("\nFist term A[1]: %f\nLast term A[%d]: %f\n\nSerie:",a1,n,an);
for(long i=1;i<=n;i++){
printf("%f",a1+(i-1)*d);
if(i<n) printf(", ");
}
}
Comment/Reply (w/o sign-up)