# Decode School

##### Decode School - The School for Problem Solvers
Welcome to My Blog.
Need Assignment / Project Guidance (or) Training in Python?

# 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 = 0n = numwhile n != 0:    rem = n % 10    if rem == digit:       print("{} is occured in {}".format(digit,num))       break    n = n // 10else:    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.