Experian Interview Question

Giving the problem with applied pattern solve them using if else statement.