Problem : Who is the winner? (Level 1)
- Problem description
Alice and Bob are playing a game. Both of them write down an integer number. If the sum oftwo integers is a square of an integer, Alice wins the game. If the reversed number of the sumis a square of an integer, Bob wins. If neither of them wins, or both of them win, it is a tie. Forexample, Alice wrote an 8, Bob wrote a 10. 18 is not a square of any integer. But 81 is a squareof 9. So Bob is the winner.
Write two functions int is_square(int num) and int reverse(int num) to check whether num is asquare number or not and reverse num, respectively. Then the program should call bothfunctions and output the winner information.- Input & output requirements
Input two positive integer numbers. The output should follow the format as shown in sample
results.- Sample resultsSample 1
8 10↲Bobs winsSample 22 2↲
Tie