Posts by SnSilva • 19 points
6 posts
-
0
votes0
answers41
viewsQ: I need to reverse a vector
I need to know how to change this logic to receive vectors of any size. public void inverter(int[] vetor) { int i; int temp; for(i=0; i < 3; i++){ temp = vetor[i]; vetor[i] = vetor[8-i];…
-
0
votes1
answer46
viewsQ: How do I print on the screen the equal values of two integer vectors?
I did it using two ties for, but the teacher did not accept. I need to do the comparison using only a while loop. EX. vetorA = {1,2,3,4,5,6,7,8} , vetorB = {3,4,7,8,9,10} So it works, but it needs…
-
-1
votes1
answer605
viewsQ: How to find the largest element of a vector recursively?
I could only do it iteratively, but recursively I have no idea how to start.
-
0
votes2
answers691
viewsQ: How to exchange the lowest value of a vector with the highest value?
For now I can only find the smallest and largest, but I can’t change positions. for(int i=0; i < vetor.length; i++){ temp = vetor[i]; if(maior < temp){ maior = vetor[i]; vetor[i] = menor;…
-
1
votes2
answers364
viewsQ: Logic to get the lowest user read value
What’s wrong with my logic? I can’t return the smallest value def menor(size): size = size vet = [0] * size menor = 0 for i in range(size): vet[i] = int(input('Digite os valores: ')) if vet[i] >…
-
-4
votes1
answer964
viewsQ: How to find the lowest value of a python vector?
Could someone help me with the logic of this function? This function must receive an integer vector and return the smallest value within that vector. Ex: minimo([1,2,3,5,8,9,0,-2]) -> -2…
python-3.xasked SnSilva 19