UST Interview Question

Simple c program and how we can compute it in more efficient way