-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDivisibleBy7And13.java
More file actions
31 lines (22 loc) · 1.01 KB
/
DivisibleBy7And13.java
File metadata and controls
31 lines (22 loc) · 1.01 KB
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
28
29
30
31
import java.util.Scanner;
public class DivisibleBy7And13 {
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.print("Enter a number: ");
int number = scanner.nextInt();
if (number % 7 == 0 && number % 13 == 0) {
System.out.println(number + " is divisible by both 7 and 13.");
int quotient7 = number / 7;
int remainder7 = number % 7;
int quotient13 = number / 13;
int remainder13 = number % 13;
System.out.println("Quotient when divided by 7: " + quotient7);
System.out.println("Remainder when divided by 7: " + remainder7);
System.out.println("Quotient when divided by 13: " + quotient13);
System.out.println("Remainder when divided by 13: " + remainder13);
} else {
System.out.println(number + " is not divisible by both 7 and 13 simultaneously.");
}
scanner.close();
}
}