Find the integers that doesnot ends with T1 or T2 when squared and added X | Function to print the elements Not ending with T1 or T2 ; Flag to check if none of the elements Do not end with t1 or t2 ; Traverse through all the elements ; Temporary variable to store the value ; If the last digit is neither t1 nor t2 then ; Print the number ; Set the flag as False ; If none of the elements meets the specification ; Test case 1 ; Call the function ; Test case 2 ; Call the function
def findIntegers ( n , a , x , t1 , t2 ) : NEW_LINE INDENT flag = True NEW_LINE for i in range ( n ) : NEW_LINE INDENT temp = pow ( a [ i ] , 2 ) + x NEW_LINE if ( temp % 10 != t1 and temp % 10 != t2 ) : NEW_LINE INDENT print ( temp , end = " ▁ " ) NEW_LINE flag = False NEW_LINE DEDENT DEDENT if flag : NEW_LINE INDENT print ( - 1 ) NEW_LINE DEDENT DEDENT N , X , T1 , T2 = 4 , 10 , 5 , 6 NEW_LINE a = [ 3 , 1 , 4 , 7 ] NEW_LINE findIntegers ( N , a , X , T1 , T2 ) ; NEW_LINE print ( ) NEW_LINE N , X , T1 , T2 = 4 , 2 , 5 , 6 NEW_LINE b = [ 2 , 18 , 22 , 8 ] NEW_LINE findIntegers ( N , b , X , T1 , T2 ) NEW_LINE