From 2708f06a553dcc3d041ae95f15ca17799d3094c1 Mon Sep 17 00:00:00 2001 From: Justsvetoslavov Date: Wed, 27 Oct 2021 23:11:32 +0300 Subject: Update Pract 03-04 --- pract_SI/Pract. 03-04/Solutions/task3.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 pract_SI/Pract. 03-04/Solutions/task3.cpp (limited to 'pract_SI/Pract. 03-04/Solutions/task3.cpp') diff --git a/pract_SI/Pract. 03-04/Solutions/task3.cpp b/pract_SI/Pract. 03-04/Solutions/task3.cpp new file mode 100644 index 0000000..a6a6362 --- /dev/null +++ b/pract_SI/Pract. 03-04/Solutions/task3.cpp @@ -0,0 +1,22 @@ +#include +using namespace std; +int main() +{ + unsigned long long oldNumber, newNumber; + + cout << "Enter a positive number: "; + cin >> oldNumber; + + oldNumber *= oldNumber; + newNumber = 0; + + while (oldNumber != 0) + { + newNumber = newNumber * 10 + oldNumber % 10; + oldNumber /= 10; + } + + cout << newNumber << endl; + + return 0; +} \ No newline at end of file -- cgit v1.3.1-23-gd82d