From 4fc1e9417b3db34e42f0196c073c8da4f3a99030 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:17:19 +0000 Subject: [PATCH] Add 2024/task2.cpp --- 2024/task2.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 2024/task2.cpp diff --git a/2024/task2.cpp b/2024/task2.cpp new file mode 100644 index 0000000..182cb97 --- /dev/null +++ b/2024/task2.cpp @@ -0,0 +1,26 @@ +#include +using namespace std; + +// "2561" => "2*5*6*1=60" +int main () +{ + int a; + + cin >> a; + + int d1, d2, d3, d4, sum; + d1 = a % 10; + d2 = a / 10 % 10; + d3 = a / 100 % 10; + d4 = a / 1000; + + cout + << d4 << '*' + << d3 << '*' + << d2 << '*' + << d1 << '=' + << d1 * d2 * d3 * d4 + ; + + return 0; +}