From b3dbc2bdb9872ef02f5a9a91688b43545555c3be Mon Sep 17 00:00:00 2001 From: Misha Date: Tue, 30 Sep 2025 15:09:25 +0300 Subject: [PATCH] =?UTF-8?q?=D0=97=D0=B0=D0=B3=D1=80=D1=83=D0=B7=D0=B8?= =?UTF-8?q?=D1=82=D1=8C=20=D1=84=D0=B0=D0=B9=D0=BB=D1=8B=20=D0=B2=20=C2=AB?= =?UTF-8?q?/=C2=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- task1.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 task1.cpp diff --git a/task1.cpp b/task1.cpp new file mode 100644 index 0000000..f921a22 --- /dev/null +++ b/task1.cpp @@ -0,0 +1,20 @@ +#include +using namespace std; + +int main() { + int n; + cout << "Enter a four-digit number: "; + cin >> n; + + if (n < 1000 || n > 9999) { + cout << "Error! This is not a four-digit number." << endl; + } else { + int a = n / 1000; + int b = (n / 100) % 10; + int c = (n / 10) % 10; + int d = n % 10; + int r = c * 1000 + d * 100 + a * 10 + b; + cout << "Result: " << r << endl; + } + return 0; +}