Menu Close

Print all numbers less than n which are having digits only 3 or 7 or both.

Print all numbers less than NGiven integer n, you need to print all numbers less than n which are having digits only 3 or 7 or both.
Input: 10
Ouput: 3
7

N=input('Enter integer N : ')
for i in range(1,int(N)):
    temp=str(i)
    if ('3' in temp) or ('7' in temp):
        print(i)

Input_1:
Enter integer N : 10
Output:
3
7


Input_2:
Enter integer N : 20
Output:
3
7
13
17


Sample output:

Python program executed in terminal

Morae Q!