From 241f5acf71beb559007eea664d5aa94a636e204a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D1=8B=D1=82=D0=BA=D0=BE=D0=B2=20=D0=A0=D0=BE=D0=BC?= =?UTF-8?q?=D0=B0=D0=BD?= Date: Sat, 20 Sep 2025 21:52:53 +0300 Subject: [PATCH] =?UTF-8?q?=D0=B8=D1=81=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7?= =?UTF-8?q?=D0=BE=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=B1=D0=B5=D0=B7=D0=BE?= =?UTF-8?q?=D0=BF=D0=B0=D1=81=D0=BD=D0=BE=D0=B3=D0=BE=20sscanf?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- casm/c.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) 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