diff options
1 files changed, 17 insertions, 0 deletions
| -rw-r--r-- | Sem. 06/Solutions/exercise01.cpp | 17 |
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 <iostream> + +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; +} |
