how to store this series in an integer array

Objective :
i want to store the output of this series in an integer array ..
and print the sum
the average of the numbers
and sq. of sum of the numbers of the series by functions

problems:
if i declare an array and use a 2nd loop and use i as both the array's index and the 2nd loop's index then i can't get to store elements of the series in the array

i tried to use 2 seperate arrays but that didn't work for me either as i couldn't merge both of them into another array
so then i could use that third array in the functions .. and even then how would i use the array in the functions .. by another loop ?

Re: how to store this series in an integer array

Posted 07 October 2012 - 04:04 AM

I feel that you are going about storing into the array because you are fixated on using the for loop variable both as the value that is to be stored as well as an an array index. The trick is to use another variable.

This code will pick out the capital letters from a string and just store that into an array.

Re: how to store this series in an integer array

Posted 07 October 2012 - 07:45 AM

Thank you all for the codes
now i need guidance as to how to get the average of the numbers
and sq. of sum of the numbers of the series by functions
that was the Objective !! thanks again for the series SkyDiver and Mohit!!
i need some more help about the functions .. the code is getting too messy