i am able to provide input values only for 3 times but in for loop i have written code to enter input for five times.
when trying to give the input values fourth time, it is directly printing my given values that in strange order.why?

When you push the enter button in the terminal and therefore inserting a new line character. The next call to scanf continue to read what is in the buffer (that is, the new line from the previous entry in the terminal), you can skip that from your result by putting a space character before %c in your scanf call.