- 3
Find the sum of following series 2/9-5/13+8/17... upto 7 terms
9 ответов
+ 1
Ujjwal Kumar what's the benefit to use a loop, since you could compute the result in only one expression evaluation?
+ 1
Ujjwal Kumar what are you meaning by "limit"? with my solution (only mathematically expressed, charge to OP to code it) you could ask the user also for what term he want the result ^^
+ 1
That's why I didn't notice the minus sign for even term: in my mind the sum about the OP was asking was the sum partially wrote (and the serie was 2/9, 5/13, 8/17...)
Honnestly, maths are not really my area of skills; I practice a few sometimes (to do 2d/3d graphics programing, solve codewars.com katas...), but that's not exactly my cup of tea... and my college courses are far far far away ^^
For now, my bad was to only focus on finding the pattern :P
0
u[ t ] = (2 + 3"t*) / (3 + 4*t)
term[ i ] = u[ i-1 ]
term[ 7 ] = u[ 6 ]
term[ 7 ] = (2 + 21) / (3 + 28)
term[ 7 ] = 23 / 31
~ swim ~ being skilled in programing doesn't require to be skilled in this field of logic solving ^^ (even if improving any kind of logic will less or more improve our global logic, wich is not bad for our programing logic ;)
0
For(i=1;i<=7;i++)
{
if(i%2==1)
Sum=Sum+(2+(i-1)*3)/(5+(i-1)*4);
else
Sum=Sum-(2+(i-1)*3)/(5+(i-1)*4);
}
//Arithmetic propagation
// for ith term= first term + (i-1)*common difference.
0
You can change the limit by asking the user.. so it is best way to make the program flexible..
0
Okay! I agree with you.. but you have mistaken. The question have -ve sign at even terms.. so the answer that you gave is incorrect.
0
Ujjwal Kumar :D caught!
You're right: I didn't noticed that ^^
My bad ;)
0
And your context.. just gives the 7th term.. not the sum of 7 terms. 🤗