10
Reply

how this can be done

saudyonline

saudyonline

Oct 16 2004 8:40 AM
2.2k
if the number of generating " myArray[i]" for many times depends on a number entered by the user. for example:. if the user enter 3 - the program will generate it something like the following myArray[i] + myArray[i+1] + myArray[i+2] // (1) else if the user enter 4 the following will be generated myArray[i] + myArray[i+1] + myArray[i+2] + myArray[i+3] // (2) i need to use the result of (1) or (2) in another "for loop", as for(int i =0;i<10;i++) { // the problem how to get the following from the previous (1) or (2) // to make " i " used by the second for loop myArray[i] + myArray[i+1] + myArray[i+2] }

Answers (10)