Add 2024/task10.cpp

This commit is contained in:
2024-12-20 17:39:08 +00:00
parent fdbb6dcf0c
commit fead9fcbae

27
2024/task10.cpp Normal file
View File

@@ -0,0 +1,27 @@
#include <iostream>
using namespace std;
// "2561" => "2+5+6+1=14"
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;
cout
<< d4 << '+'
<< d3 << '+'
<< d2 << '+'
<< d1 << '='
<< d1 + d2 + d3 + d4
;
return 0;
}