Experian interview question

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