forked from tangorishi/learnJava
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBuzzNumberChecker.java
More file actions
27 lines (22 loc) · 863 Bytes
/
BuzzNumberChecker.java
File metadata and controls
27 lines (22 loc) · 863 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import java.util.Scanner;
public class BuzzNumberChecker {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Enter an integer: ");
// Read the input integer
int number = scanner.nextInt();
// Check if it's a Buzz number
if (isBuzzNumber(number)) {
System.out.println(number + " is a Buzz number.");
} else {
System.out.println(number + " is not a Buzz number.");
}
// Close the scanner
scanner.close();
}
// Function to check if a number is a Buzz number
public static boolean isBuzzNumber(int number) {
// Check if the number ends with 7 or is divisible by 7
return (number % 10 == 7) || (number % 7 == 0);
}
}