Infogain Interview Question

code for arithmetic progression