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

27th Nov 2018, 8:49 AM
Akelemor Bright Cleverly
Akelemor Bright Cleverly - avatar
2 ответов
+ 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)
27th Nov 2018, 8:58 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 2
I so much appreciate.
27th Nov 2018, 9:02 AM
Akelemor Bright Cleverly
Akelemor Bright Cleverly - avatar