c, scanf, EOF, while loop
I'm trying to run my program, but after I enter one input it doesn't print anything. If I press Command+D, the program ends without printing the output I put at the end. #include <stdio.h> # define N 100 int main(void) { int n = 1, counter = 0; while (scanf("%d", &n) == 1) { if (n%N > (n/N)%(N)) { counter += 3; } else if (n%N < (n/N)%(N)) { counter += 0; } else { counter += 1; } } printf("%d\n", n); printf("%d\n", counter); return 0; }
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.