-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathass2.java
More file actions
28 lines (19 loc) · 736 Bytes
/
Copy pathass2.java
File metadata and controls
28 lines (19 loc) · 736 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
28
public class ass2 {
public static void main(String[] args) {
int count = 0;
// Loop through all combinations of three different digits
for (int i = 1; i <= 4; i++) {
for (int j = 1; j <= 4; j++) {
for (int k = 1; k <= 4; k++) {
// Ensure all digits are unique
if (i != j && i != k && j != k) {
System.out.println(i + "" + j + "" + k);
count++;
}
}
}
}
// Print the total count of unique numbers
System.out.println("Total number of unique three-digit numbers: " + count);
}
}