2
Two questions about vectors and matrices. 1_Dado any vector with 100 integers, make a module that tells if there is or not repeated numbers on this vector.
Algorithm "Repetition in the vector"
Var
// Seção de Declarações das variáveis
vet : vetor [1..10] de inteiro
i,j, aux: inteiro
rep: inteiro
Inicio
// Seção de Comandos, procedimento, funções, operadores, etc...
para i de 1 ate 10 faca
leia (vet[i])
fimpara
para i de 1 ate 9 faca
para j de i ate 10 faca
se vet[j] < vet[i] entao
aux <- vet[j]
vet[j] <- vet[i]
vet[i]<- aux
fimse
fimpara
fimpara
para i de 1 ate 10 faca
escreva (vet[i])
fimpara
rep<- (vet[1])
para i de 1 ate 10 faca
se (vet[i] = rep) entao
escreva ("O numero", rep," está repetido.")
fimse
fimpara
Fimalgoritmo
// in this algorithm unfortunately it only points if it has only 1 repeated number.
2_Dado an array of 20 real numbers and a 20x20 matrix of real numbers, enter which ones rows and columns are equal to the vector, either in the given order or in reverse order. Assume that there must be a row or column equal to the vector in the matrix.
What have you tried to do? It would be interesting to add your attempt to the pegunta by clicking on [Dit]
– user28595
Okay, sorry, I’m new here :)
– Mathias Souza