 # Python Program to Check Buzz Number or Not

In the previous article, we have discussed Python Program to Calculate the Area of a Trapezoid
Buzz Number:

If a number ends in 7 or is divisible by 7, it is referred to as a Buzz Number.

some of the examples of Buzz numbers are 14, 42, 97,107, 147, etc

The number 42 is a Buzz number because it is divisible by ‘7’.
Because it ends with a 7, the number 107 is a Buzz number.

Given a number, the task is to check whether the given number is Buzz Number or not.

Examples:

Example1:

Input:

Given number = 97

Output:

The given number { 97 } is a Buzz Number

Example2:

Input:

Given number = 120

Output:

The given number { 120 } is not a Buzz Number

## Program to Check Buzz Number or Not

Below are the ways to check whether the given number is Buzz Number or not.

### Method #1: Using modulus operator (Static input)

Approach:

• Give the number as static input and store it in a variable.
• Check if the given number modulus ‘7’ is equal to ‘0’ or if the given number modulus ’10’ is equal to ‘7’ or not using if conditional statement.
• If the above statement is True, then print “The given number is a Buzz Number”.
• Else if the statement is False, print “The given number is Not a Buzz Number”.
• The Exit of the program.

Below is the implementation:

# Give the number as static input and store it in a variable.
gvn_numbr = 14
# Check if the given number modulus '7' is equal to '0' or if the given number modulus '10'
# is  equal to '7' or not using if  conditional statement.
if gvn_numbr % 7 == 0 or gvn_numbr % 10 == 7:
# If the above statement is True ,then print "The given number is a Buzz Number".
print("The given number {", gvn_numbr, "} is a Buzz Number")
else:
# Else if the statement is False, print "The given number is Not a Buzz Number" .
print("The given number {", gvn_numbr, "} is not a Buzz Number")


Output:

The given number { 14 } is a Buzz Number

Here the number 14 is a Buzz Number.

### Method #2: Using modulus operator (User input)

Approach:

• Give the number as user input using int(input()) and store it in a variable.
• Check if the given number modulus ‘7’ is equal to ‘0’ or if the given number modulus ’10’ is equal to ‘7’ or not using if conditional statement.
• If the above statement is True, then print “The given number is a Buzz Number”.
• Else if the statement is False, print “The given number is Not a Buzz Number”.
• The Exit of the program.

Below is the implementation:

# Give the number as user input using int(input()) and store it in a variable.
gvn_numbr = int(input("Enter some random number = "))
# Check if the given number modulus '7' is equal to '0' or if the given number modulus '10'
# is  equal to '7' or not using if  conditional statement.
if gvn_numbr % 7 == 0 or gvn_numbr % 10 == 7:
# If the above statement is True ,then print "The given number is a Buzz Number".
print("The given number {", gvn_numbr, "} is a Buzz Number")
else:
# Else if the statement is False, print "The given number is Not a Buzz Number" .
print("The given number {", gvn_numbr, "} is not a Buzz Number")


Output:

Enter some random number = 49
The given number { 49 } is a Buzz Number

Explore more instances related to python concepts from Python Programming Examples Guide and get promoted from beginner to professional programmer level in Python Programming Language.