projects
/
tools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
| inline |
side by side
round: ignore empty lines
[tools.git]
/
math
/
round.c
diff --git
a/math/round.c
b/math/round.c
index
e422fd0
..
f87d3c1
100644
(file)
--- a/
math/round.c
+++ b/
math/round.c
@@
-6,6
+6,8
@@
int main(int argc, char **argv) {
double target = strtod(argv[1], NULL);
char line[128];
while (fgets(line, sizeof(line), stdin)) {
+ trim_end(line, "\r\n \t");
+ if (!*line) continue;
double n = strtod(line, NULL);
double quot = n / target;
quot = round(quot);