# Find given number is a digit in a number using Python

Get a number and a digit and find whether the digit is occurred in the number.

Sample Input 1:

Enter the number: 234

Enter the Digit : 4

Sample Output 1:

4 is occurred in 234

Sample Input 2:

Enter the number: 974

Enter the Digit : 3

Sample Output 2:

3 is not occurred in 974

#### Program or Solution

```
```
num = int(input("Enter the number"))

digit = int(input("Enter a Digit"))

count = 0

n = num

while n != 0:

rem = n % 10

if rem == digit:

print("{} is occured in {}".format(digit,num))

break

n = n // 10

else:

print("{} is not occured in {}".format(digit,num))

#### Program Explanation

calculate the remainder of a number by doing number % 10

check remainder is equal to digit, if it is equal print digit occurred, else divide number by the 10 and repeat the above steps till number becomes zero.

#### Related Programs

- Count the number of digits in a Number in Python
- Count the Number of Occurrences of digit in a number using Python
- Print the first Digit of a Number using Python
- Sum of Digits of the number using Python
- Product of Digits of the number using Python
- Reverse the digits of a number using Python
- Find a number is Armstrong number or not using Python

coming Soon

coming Soon