Given a number N, the task is to check whether the number is Trimorphic number or not. A number is called Trimorphic number if and only if its cube ends in the same digits as the number itself. In other words, number appears at the end of its cube.
The first line contains an integer T, denoting the number of testcases. T testcases follow. Each testcase contains a single integer N as input.
Print 1 if the number is trimorphic; else print 0.
For testcase 3: 24 is N.The cube of 24 is 13824. Since 13824 contains 24, so 24 is a trimorphic number. We print 1.
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.