From 00f15aa8d69a53c3ffa55661283aa06a6d6bd30f Mon Sep 17 00:00:00 2001 From: Justsvetoslavov Date: Thu, 28 Oct 2021 17:33:12 +0300 Subject: Update sem.03 --- pract_SI/Pract. 03/Solutions/task3.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 pract_SI/Pract. 03/Solutions/task3.cpp (limited to 'pract_SI/Pract. 03/Solutions/task3.cpp') diff --git a/pract_SI/Pract. 03/Solutions/task3.cpp b/pract_SI/Pract. 03/Solutions/task3.cpp new file mode 100644 index 0000000..a6a6362 --- /dev/null +++ b/pract_SI/Pract. 03/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