Develop a program that reads ten elements of a matrix A vector type. Construct a matrix B of the same type, observing the following formation law: 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 contents of matrix A and B .
When I compile the program it 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 = index%;" as the line with error. From now on 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]);