This commit is contained in:
2026-01-29 22:07:37 +03:00
parent 67357cf271
commit 3fbdccb52a
42 changed files with 60 additions and 3510 deletions

20
java/sum/Sum.java Normal file
View File

@@ -0,0 +1,20 @@
package sum;
public class Sum {
public static void main(String[] args) {
int res = 0;
for (String arg : args) {
StringBuilder builder = new StringBuilder();
for (char c : arg.toCharArray()) {
if (!Character.isWhitespace(c)) {
builder.append(c);
} else {
res += (!builder.toString().isEmpty()) ? Integer.parseInt(builder.toString()) : 0;
builder = new StringBuilder();
}
}
res += (!builder.toString().isEmpty()) ? Integer.parseInt(builder.toString()) : 0;
}
System.out.println(res);
}
}