1
I have pending exercise to find the largest element in a fixed vector of 10 elements. However, when declaring the array integers works, but when I ask the user to enter the values does not work.
int i, v[10];
int maior = v[0];
for(i = 1; i < 10; i++){
scanf("%d", &v[i]);
if(maior < v[i])
maior = v[i];
}
printf("Maior = %d\n", maior);
It would be because it is using the smaller operator to check if it is bigger?
– Maniero
For what you’re trying to do you don’t need the array, and it turns out to be the reason why it doesn’t work
– Isac
I saw it just now, but my doubt is because I’m initiating the matrix with the right input values to show the biggest ?
– Denilson Silva
for me it was supposed to work, Getting bigger with the first element of the vector and testing so on
– Denilson Silva