#include <jh.h>
#include <math.h>
+#include <stdbool.h>
int main(int argc, char **argv) {
if (argc != 2) xperror("invocation: round <target>", 0);
double target = strtod(argv[1], NULL);
+ bool intmode = (target == floor(target));
char line[128];
while (fgets(line, sizeof(line), stdin)) {
trim_end(line, "\r\n \t");
double quot = n / target;
quot = round(quot);
n = quot * target;
- printf("%f\n", n);
+ if (intmode) {
+ printf("%lld\n", (long long)n);
+ } else {
+ printf("%f\n", n);
+ }
}
return 0;
}