While20. An integer N (> 0) is given. By using the integer division and taking the remainder from the division, determine whether there is a digit "2" in the record of the number N. If there is, output TRUE; if not, print FALSE.

Solution in Python 3:

import random

N = random.randrange(1,100000)
print("N = ",N)
q = N
i = 0
flag = False
while q >= 1:
i += 1
r = q % 10
print(i," - ",r)
if r == 2:
flag = True
break
q = int(q/10)

print(flag)