//program to get sum of (2x3)/5+(4x5)/7+(6x7)/9+,.... to nth term.
#include<stdio.h>
#include<stdio.h>
#include<conio.h>
void main()
{
float i,n,k=2,m=3,p=5,sum=0;
{
float i,n,k=2,m=3,p=5,sum=0;
printf("enter positive number for 'n'\n");
scanf("%f",&n);
scanf("%f",&n);
for(i=1;i<=n;i++)
{
{
sum=sum+(k*m)/p;
k=k+2;
m=m+2;
p=p+2; }
printf("the sum=%f",sum);
getch();
}
}
-------------------------------------------------------------------------------------------------------------------------------------------------
logics in mind:
->enter a number for range for which you want to get sum, say 'n'.
->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
k=k+2;
m=m+2;
p=p+2; inside loop.
->at last we display final sum.