I have a program that will check 9 numbers and say which one is the largest of all, and for this I am using vetor
already filled with values, and am using a for
to go through all vetor
e look for the greater. The problem is that I am not able to show which index number is the largest of them all.
My code:
setlocale(LC_ALL,"portuguese");
int bolas[9] = {0,0,0,0,20,0,0,0,0};
for(int i = 0; i < 9; i++) {
if(bolas[i] > bolas[i+1]) {
printf("A bola %d é maior que todas as outras. ",bolas[i]);
}
}
In this code, in the part of printf
it will show the size of the number, not its position in the index, I need to show the position and not the size. How can I do this?