From ab0ef4037c84739617e7eda7f5a4fd0457e2377c 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:41:52 +0000 Subject: [PATCH] Add 2024/task12.cpp --- 2024/task12.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 2024/task12.cpp diff --git a/2024/task12.cpp b/2024/task12.cpp new file mode 100644 index 0000000..80135ce --- /dev/null +++ b/2024/task12.cpp @@ -0,0 +1,23 @@ +#include +using namespace std; + +// "2561" => "1652+2561=4213" +int main () +{ + int a,b; + + cin >> a; + + int d1, d2, d3, d4; + + d1 = a % 10; + d2 = a / 10 % 10; + d3 = a / 100 % 10; + d4 = a / 1000; + + b = d1 * 1000 + d2 * 100 + d3 * 10 + d4; + + cout << b << '+' << a << '=' << a+b; + + return 0; +}