-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDivisibleBySevenAndThirteen.java
More file actions
36 lines (32 loc) · 1.6 KB
/
DivisibleBySevenAndThirteen.java
File metadata and controls
36 lines (32 loc) · 1.6 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
32
33
34
35
36
public class DivisibleBySevenAndThirteen {
public static void main(String[] args) {
int number = 91; // Replace with the number to check
boolean divisibleBySeven = number % 7 == 0;
boolean divisibleByThirteen = number % 13 == 0;
if (divisibleBySeven && divisibleByThirteen) {
int quotientBySeven = number / 7;
int remainderBySeven = number % 7;
int quotientByThirteen = number / 13;
int remainderByThirteen = number % 13;
System.out.println("The number is divisible by both 7 and 13.");
System.out.println("Quotient when divided by 7: " + quotientBySeven);
System.out.println("Remainder when divided by 7: " + remainderBySeven);
System.out.println("Quotient when divided by 13: " + quotientByThirteen);
System.out.println("Remainder when divided by 13: " + remainderByThirteen);
} else if (divisibleBySeven) {
int quotient = number / 7;
int remainder = number % 7;
System.out.println("The number is divisible by 7.");
System.out.println("Quotient: " + quotient);
System.out.println("Remainder: " + remainder);
} else if (divisibleByThirteen) {
int quotient = number / 13;
int remainder = number % 13;
System.out.println("The number is divisible by 13.");
System.out.println("Quotient: " + quotient);
System.out.println("Remainder: " + remainder);
} else {
System.out.println("The number is not divisible by 7 or 13.");
}
}
}