program to get sum of (2x3)/5+(4x5)/7+(6x7)/9+,.... to nth term.

//program to get sum of (2x3)/5+(4x5)/7+(6x7)/9+,....           to nth term.
void main()
   float i,n,k=2,m=3,p=5,sum=0;
      printf("enter  positive number for 'n'\n");
          p=p+2;        }
  printf("the sum=%f",sum);
logics in mind:
->enter a number for range for which you want to get sum, say 'n'.
->let a variable 'sum' with initial value '0'
->we get sum using formula sum=sum+(k*m)/p because in terms (2x3)/5+(4x5)/7+(6x7)/9+,...     ,
        the first value is k(2),second is m(3) and third is p(5).the values in second and all other terms are changing 
       by +2 so
        we put
          p=p+2; inside loop.
->at last we display final sum.

No comments:

Post a Comment