Buscar

1) Implement a function diferencaMatriz that receives a matrix of integers and its dimensions m and n. The function should return the difference be...

1) Implement a function diferencaMatriz that receives a matrix of integers and its dimensions m and n. The function should return the difference between the sum of even numbers and the sum of odd numbers in the matrix. Analyze the code below and choose the correct alternative:

The function diferencaMatriz returns the difference between the sum of even numbers and the sum of odd numbers in the matrix.
The variable diferenca is initialized with zero.
The variable somapar stores the sum of even numbers in the matrix.
The variable somaimpar stores the sum of odd numbers in the matrix.
a) All affirmations are correct.
b) Only affirmations 1 and 2 are correct.
c) Only affirmations 1, 3 and 4 are correct.
d) Only affirmation 1 is correct.

Essa pergunta também está no material:

AP 2   Computação I   2017 2
2 pág.

Computação Universidade Federal FluminenseUniversidade Federal Fluminense

💡 1 Resposta

User badge image

Ed Verified user icon

A alternativa correta é a letra C) Apenas as afirmações 1, 3 e 4 estão corretas. Explicação: - A afirmação 1 está correta, pois a função diferencaMatriz retorna a diferença entre a soma dos números pares e a soma dos números ímpares na matriz. - A afirmação 2 está incorreta, pois a variável diferenca é inicializada com o valor da diferença entre a soma dos números pares e a soma dos números ímpares na matriz, e não com zero. - A afirmação 3 está correta, pois a variável somapar armazena a soma dos números pares na matriz. - A afirmação 4 está correta, pois a variável somaimpar armazena a soma dos números ímpares na matriz.

0
Dislike0

✏️ Responder

SetasNegritoItálicoSublinhadoTachadoCitaçãoCódigoLista numeradaLista com marcadoresSubscritoSobrescritoDiminuir recuoAumentar recuoCor da fonteCor de fundoAlinhamentoLimparInserir linkImagemFórmula

Para escrever sua resposta aqui, entre ou crie uma conta

User badge image

Outros materiais