- 3

Find the sum of following series 2/9-5/13+8/17... upto 7 terms

25th Apr 2020, 5:44 PM
HARSHIT
HARSHIT - avatar
10 ответов
+ 1
Ujjwal Kumar what's the benefit to use a loop, since you could compute the result in only one expression evaluation?
26th Apr 2020, 3:04 AM
visph
visph - avatar
+ 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 ^^
26th Apr 2020, 3:13 AM
visph
visph - avatar
+ 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
26th Apr 2020, 3:46 AM
visph
visph - avatar
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 ;)
26th Apr 2020, 2:23 AM
visph
visph - avatar
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.
26th Apr 2020, 2:51 AM
Ujjwal kumar
Ujjwal kumar - avatar
0
You can change the limit by asking the user.. so it is best way to make the program flexible..
26th Apr 2020, 3:07 AM
Ujjwal kumar
Ujjwal kumar - avatar
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.
26th Apr 2020, 3:25 AM
Ujjwal kumar
Ujjwal kumar - avatar
0
Ujjwal Kumar :D caught! You're right: I didn't noticed that ^^ My bad ;)
26th Apr 2020, 3:26 AM
visph
visph - avatar
0
And your context.. just gives the 7th term.. not the sum of 7 terms. 🤗
26th Apr 2020, 3:33 AM
Ujjwal kumar
Ujjwal kumar - avatar