How to choose one element from each array., Which A(i)+B(i)+C(i)+D(i)+E(i)+F(i) must equal to 10.

__________________________________________________
i A B C D E F
__________________________________________________
1 3 2 3 3 2 4
__________________________________________________

2 6 9 4 24 5 7
__________________________________________________

3 11 28 5 81 10 12
__________________________________________________

4 18 65 6 192 17 19
__________________________________________________

5 27 126 7 375 26 28
__________________________________________________

6 38 217 8 648 37 39
__________________________________________________

Sorry, I don't understand your question. Do you mean How do you select the same element from a series of arrays and add them together?

post what you have done so have or what steps you are thinking to solve the problem...
then only we will be able to help you...

like this, but I want to choose one elemet from each array, which the sum of A(i)+B(i)+C(i)
+D(i)+E(i)+F(i)=10. Which mean the value of i.

int total = 0;
for(int i = 0;i<10;i++)
{
total = a + b + c + d + e;
if(total==10)
{
printf("total is 10");
}
total=0;
}

Try something like:

int total = 0;
for (int i=0;i<10;i++) {
total = a[i]+b[i]+c[i]+d[i]+e[i];
// print result
printf("total = "+total+"\n");
// print i to see which iteration of the loop
printf("i = "+i+"\n");
}
/* there is no need to reset total as it will be recalculated on the next iteration of the loop */

This should at least give you a clearer understanding of what is going on with your code, if not answer your question?

This article has been dead for over six months. Start a new discussion instead.