Why this is not giving correct output and runtime error?

Why this is not giving correct output and runtime error?