From e97247c85a207fdd86502e63360c6799f97b312e Mon Sep 17 00:00:00 2001 From: Syndamia Date: Wed, 17 Nov 2021 09:17:58 +0200 Subject: Solved all exercises from Sem06 --- Sem. 06/Solutions/exercise01.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Sem. 06/Solutions/exercise01.cpp (limited to 'Sem. 06/Solutions/exercise01.cpp') diff --git a/Sem. 06/Solutions/exercise01.cpp b/Sem. 06/Solutions/exercise01.cpp new file mode 100644 index 0000000..50d2fe0 --- /dev/null +++ b/Sem. 06/Solutions/exercise01.cpp @@ -0,0 +1,17 @@ +#include + +using namespace std; + +bool isPalindromeArray(int nums[], int len) { + for (int i = 0; i < len / 2; i++) { + if (nums[i] != nums[len - 1 - i]) + return false; + } + return true; +} + +int main() { + int numbers[5] = { 1, 2, 3, 2, 1 }; + + cout << isPalindromeArray(numbers, 5) << endl; +} -- cgit v1.3.1-23-gd82d