0
Consider the odd series 1, 3, 5, 7.... 97. Write a function to this series up the last term. Hence print the sum and average.
A QUESTION
2 odpowiedzi
+ 8
● for adding series of odd numbers
//mathematical way
Sn = n*n
//through coding
1.1)run the loop adding 2 each time in a variable whose initial value is 1 & add that variable to a varible sum each time the loop runs to give Sn .
● for finding average , since odd numbers series is also an A.P (Arithmetic Progression)
//mathematical ways
1)so average of 1st and last term will the average of whole series [OR U can say 2nd & 2nd last term OR if odd numbers of term then middle most number will be average of series]
2)alternatively , Sn/n [Sn calculated in above ●](best way here)
+ 2
I so much appreciate.