Page 1 of 1

Write a program that has the following : The program should input 10 numbers in each array (you may use a for loop and s

Posted: Sat May 14, 2022 4:05 pm
by answerhappygod
Write a program that has the following :
The program should input 10 numbers in each array (you may use
a for loop and scanf), calculate the number of
elements of the first array that are equal to the associated
element of the second array (you may use a separate for
loop and an if condition inside the loop). That
is, the value should be the number of elements for which
array1[index] == array2[index]
is true.
Finally use a printf statement to output the number of
equal elements.
You DON’T need comments,
idiotproofing or checks of whether arrays exist, and you may use
numeric literal constants anywhere you like.
HINT: Before you start examining the elements of
the arrays, you have not yet seen any instances of equality. When
you compare a particular element of array1 with the
corresponding element of array2, if they are equal, then you
have seen one additional instance of equality. Do that for each
index of the arrays.