We have to find the greater of two given number. We can store the given numbers in two different registers ( suppose register A and B). Then we will compare the contents of register B with the contents of accumulator A. If the contents A are greater than B Both CY and Z flag is reset. If the contents of A are equal to B, Z flag is set and CY flag is reset. Here we assume for simplicity of the program that the given numbers are not equal then only carry flag can decide that which number is greater. F carry flag is set the content of accumulator A are less than the contents of B otherwise the contents of B are greater than the contents of accumulator A.
Flow chart : it is better to draw the flow chart before writing the program.