Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exercise_07_05 fix 0 input #18

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions Exercise_07/Exercise_07_05/Exercise_07_05.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ public static void main(String[] args) {
// distinct numbers separated by exactly one space
System.out.println("The number of distinct numbers is " + count);
System.out.print("The distinct numbers are");
for (int i = 0; i < distinctNumbers.length; i++) {
if (distinctNumbers[i] > 0)
System.out.print(" " + distinctNumbers[i]);
for (int i = 0; i < count; i++) {
System.out.print(" " + distinctNumbers[i]);
}
System.out.println();
}
Expand All @@ -47,4 +46,4 @@ public static boolean isDistinct(int[] array, int num) {
}
return true;
}
}
}