diff --git a/casm/c.c b/casm/c.c index b74424d..02c4a95 100644 --- a/casm/c.c +++ b/casm/c.c @@ -1,4 +1,5 @@ #include +#include int sum(int a, int b) { return a+b; @@ -6,10 +7,16 @@ int sum(int a, int b) { void print(int num) { printf("%d\n", num); + fflush(stdout); } int scan() { + char buffer[100]; int res; - scanf("%d", &res); - return res; + if (fgets(buffer, sizeof(buffer), stdin) != NULL) { + if (sscanf(buffer, "%d", &res) == 1) { + return res; + } + } + return 0; // or handle error } \ No newline at end of file