結果 : how to write algorithm for if else statement