Saturday, January 30, 2010

CHAP 3[E]c Adding first seven terms of some series

Write a program to add first seven terms of the following series using a for loop:







void main()
{
float d,a,b,c,e;
printf("\nEnter a value\n");
scanf("%f",&e);

a=0;

for(d=1;d<=e;d++)
{
for(b=d,c=1;b>0;b--)
c=c*b;

a=a+d/c;
}

printf("\nThe first %f terms of the following series is %f",e,a);
}

1 comment:

  1. I am studying let us c and your solutions have helped me a lot thank you very much

    ReplyDelete