Skip to content

Commit a486ac0

Browse files
committed
Omitted negative numbers
1 parent 8b9ba95 commit a486ac0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/com/thealgorithms/maths/UniformNumbers.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ public static int uniformNumbers(int num) {
1717
}
1818

1919
public static int countUniformIntegers(int A, int B) {
20-
if (B > A) {
20+
if (B > A && (B > 0 && A > 0)) {
2121
return uniformNumbers(B) - uniformNumbers(A - 1);
2222
} else if (B == A) {
2323
return 1;

0 commit comments

Comments
 (0)