>scanf is horrible at its job as you know.
scanf is wonderful at its job. Most people just don't understand its job.
>i dont konw how to get the above answer
Trust it or trace it. There's a certain measure of trust that comes with recursion, mostly because all but the simplest of functions are difficult to trace in a reasonable amount of time. Here's the trace for your function:
Code:
Read 'y', less than 'z', call rev()
Read 's', less than 'z' call rev()
Read 'a', less than 'z' call rev()
Read 'e', less than 'z', call rev()
Read 'z', not less
Print 'z'
Print 'e'
Print 'a'
Print 's'
Print 'y'
Keep in mind that when one call to rev returns, it plops execution right back where it left off. So upon the return of rev, the next statement is the printf.