From 21fa75cf1a697206b7e0e783f425ef571a2cdf50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=98=D0=B3=D0=BE=D1=80=D1=8C?= Date: Fri, 20 Dec 2024 17:34:07 +0000 Subject: [PATCH] Add 2024/task9.cpp --- 2024/task9.cpp | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 2024/task9.cpp diff --git a/2024/task9.cpp b/2024/task9.cpp new file mode 100644 index 0000000..e05aa4b --- /dev/null +++ b/2024/task9.cpp @@ -0,0 +1,21 @@ +#include +using namespace std; + +// "256" => "625-256=369" +int main () +{ + int a,b; + + cin >> a, b; + + int d1, d2, d3; + d1 = a % 10; + d2 = a / 10 % 10; + d3 = a / 100 % 10; + + b = d1 * 100 + d3 * 10 + d2; + + cout << b << '-' << a << '=' << b-a; + + return 0; +}