Buzz Number
If the given number is completely divisible by 7 or the number is ends with 7 that is called "Buzz Number".
Example-1:
Input : n = 35 Output : Buzz Number Explain : The given number 35 is completely divisible by 7. So the number is "Buzz Number".
Example-2:
Input : n = 37 Output : Buzz Number Explain : The given number 37 that number is ends with 7. So the number is "Buzz Number".
Example-2:
Input : n = 34 Output : Not a Buzz Number Explain : The given number 34 is not ends with 7 and the number is not completely divisible by 7. So the number is "Not a Buzz Number".
Solution
public class Main { public static void main(String [] args) { int num = 35; if((num % 10) % 7 == 0|| num % 7 == 0){ System.out.print("Buzz Number"); } else{ System.out.print("Not a Buzz Number"); } } }
num = 35 if(num % 7 == 0 or num % 10 == 7): print("Buzz number") else: print("Not a Buzz number")
Output
Buzz Number