{"id":16695,"date":"2021-08-12T09:25:19","date_gmt":"2021-08-12T03:55:19","guid":{"rendered":"https:\/\/python-programs.com\/?p=16695"},"modified":"2021-11-22T18:38:32","modified_gmt":"2021-11-22T13:08:32","slug":"python-program-to-check-buzz-number-or-not","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-check-buzz-number-or-not\/","title":{"rendered":"Python Program to Check Buzz Number or Not"},"content":{"rendered":"
In the previous article, we have discussed Python Program to Calculate the Area of a Trapezoid<\/a> If a number ends in 7 or is divisible by 7, it is referred to as a Buzz Number.<\/p>\n some of the examples of Buzz numbers are 14, 42, 97,107, 147, etc<\/p>\n The number 42 is a Buzz number because it is divisible by ‘7’. Given a number, the task is to check whether the given number is Buzz Number or not.<\/p>\n Examples:<\/strong><\/p>\n Example1:<\/strong><\/p>\n Input:<\/strong><\/p>\n Output:<\/strong><\/p>\n Example2:<\/strong><\/p>\n Input:<\/strong><\/p>\n Output:<\/strong><\/p>\n Below are the ways to check whether the given number is Buzz Number or not.<\/p>\n Approach:<\/strong><\/p>\n Below is the implementation:<\/strong><\/p>\n Output:<\/strong><\/p>\n Here the number 14 is a Buzz Number.<\/p>\n Approach:<\/strong><\/p>\n Below is the implementation:<\/strong><\/p>\n Output:<\/strong><\/p>\n Explore more instances related to python concepts from\u00a0Python Programming Examples<\/a>\u00a0Guide and get promoted from beginner to professional programmer level in Python Programming Language.<\/p>\n <\/p>\n","protected":false},"excerpt":{"rendered":" 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 …<\/p>\n
\nBuzz Number:<\/strong><\/p>\n
\nBecause it ends with a 7, the number 107 is a Buzz number.<\/p>\nGiven number = 97<\/pre>\n
The given number { 97 } is a Buzz Number<\/pre>\n
Given number = 120<\/pre>\n
The given number { 120 } is not a Buzz Number<\/pre>\n
Program to Check Buzz Number or Not<\/h2>\n
\n
Method #1: Using modulus operator (Static input)<\/h3>\n
\n
# Give the number as static input and store it in a variable.\r\ngvn_numbr = 14\r\n# Check if the given number modulus '7' is equal to '0' or if the given number modulus '10'\r\n# is\u00a0 equal to '7' or not using if \u00a0conditional statement.\r\nif gvn_numbr % 7 == 0 or gvn_numbr % 10 == 7:\r\n # If the above statement is True ,then print \"The given number is a Buzz Number\".\r\n print(\"The given number {\", gvn_numbr, \"} is a Buzz Number\")\r\nelse:\r\n # Else if the statement is False, print \"The given number is Not a Buzz Number\" .\r\n print(\"The given number {\", gvn_numbr, \"} is not a Buzz Number\")\r\n<\/pre>\n
The given number { 14 } is a Buzz Number<\/pre>\n
Method #2: Using modulus operator (User input)<\/h3>\n
\n
# Give the number as user input using int(input()) and store it in a variable.\r\ngvn_numbr = int(input(\"Enter some random number = \"))\r\n# Check if the given number modulus '7' is equal to '0' or if the given number modulus '10'\r\n# is\u00a0 equal to '7' or not using if \u00a0conditional statement.\r\nif gvn_numbr % 7 == 0 or gvn_numbr % 10 == 7:\r\n # If the above statement is True ,then print \"The given number is a Buzz Number\".\r\n print(\"The given number {\", gvn_numbr, \"} is a Buzz Number\")\r\nelse:\r\n # Else if the statement is False, print \"The given number is Not a Buzz Number\" .\r\n print(\"The given number {\", gvn_numbr, \"} is not a Buzz Number\")\r\n<\/pre>\n
Enter some random number = 49\r\nThe given number { 49 } is a Buzz Number<\/pre>\n
\n