I have this array. I need to go through the array and compare two int variables. If both variables are the same then print all the variables that have the same value.

If the variable is not the same/ does not exist then ask the user to try again.

If your code finds the value in the array it prints "Hi" and quits; that's not what your assignment asks for; you should register the fact that your code found an identical value and continue the search (a boolean variable perhaps?). If, after the search has finished and nothing was found your code should ask for another value. There should be a while loop around that for loop that does the search.