2
Develop a program that scans ten elements of an A-matrix vector type. Construct a matrix B of the same type, observing the following law of formation: if the value of the index is even, the value must be multiplied by 5, being odd, must be added with 5. At the end show the content of matrix A and B.
When I go to compile the program shows the following error.
2417 19 C: Users User Documents DEV C++ aula03.cpp [Error] expected Primary-Expression before ';' token
It highlights the line "Resp = Indice %;" as the line with error. I am grateful for your help.
int matriza[10];
int matrizB[10];
int indice;
int resp;
for( indice = 0; indice < 10; indice++ )
{
printf("digite um valor numerico inteiro: ");
scanf ("%d", &matriza[indice]);
}
for(indice = 0; indice < 10; indice++)
{
resp = indice %;
if (resp == 0)
matrizB[indice] = matriza[indice] * 5;
else
matrizB[indice] = matriza[indice] + 5;
}
for(indice = 0; indice < 10; indice++)
printf ("\nConteudo da matriz a indice %d = %d", indice, matriza[indice]);
for(indice = 0; indice < 10; indice++)
printf ("\nConteudo da matriz B indice %d = %d", indice, matrizB[indice]);
Take a look at [tour]. You can accept an answer if it solved your problem. You can vote on every post on the site as well. Did any help you more? You need something to be improved?
– Maniero