Basic problem of a newbie

Hello. I am a newbie on this platform.
For the most easiest problem, when i submit this code, it shows,Your submission produced the correct output for the sample test case. But, the submission didn’t produce the correct output for the 2nd test case.

Every problem has test cases beyond the sample ones shown in the problem statement. Your program must be able to handle those hidden cases. Pay close attention to the input specification. How can i solve this?
Advanced thanks.

Let’s take one of your submissions as an example:

Instead of hard coding the value from the sample test case (e.g. here it is 2), you need to read the input from stdin, and then use it to call your printInt function.